forked from cellular-infrastructure/osmocom-analog
Add check if fromat at PDEBUG() is consistent (like printf)
The bugs it found are fixed too.
This commit is contained in:
parent
b205cfcf03
commit
0cec2f28be
|
@ -135,7 +135,7 @@ static void fsk_receive_tone(anetz_t *anetz, int tone, int goodtone, double leve
|
|||
/* lost tone because it is not good anymore or has changed */
|
||||
if (!goodtone || tone != anetz->tone_detected) {
|
||||
if (anetz->tone_count >= TONE_DETECT_TH) {
|
||||
PDEBUG(DDSP, DEBUG_INFO, "Lost %.0f Hz tone after %d ms.\n", fsk_tones[anetz->tone_detected], 1000.0 * CHUNK_DURATION * anetz->tone_count);
|
||||
PDEBUG(DDSP, DEBUG_INFO, "Lost %.0f Hz tone after %.0f ms.\n", fsk_tones[anetz->tone_detected], 1000.0 * CHUNK_DURATION * anetz->tone_count);
|
||||
anetz_receive_tone(anetz, -1);
|
||||
}
|
||||
if (goodtone)
|
||||
|
|
|
@ -621,14 +621,14 @@ again:
|
|||
if (master->frame_last_count > 0 && master->frame_last_count < length - 1 && count > 0 && count < length - 1) {
|
||||
/* if the sample count is one sample ahead, we go back one sample */
|
||||
if (count == master->frame_last_count + 1) {
|
||||
PDEBUG(DDSP, DEBUG_INFO, "Sync slave to master by going back one sample: phase(master) = %.15, phase(slave) = %.15\n", master->frame_last_phase, cnetz->frame_last_phase);
|
||||
PDEBUG(DDSP, DEBUG_INFO, "Sync slave to master by going back one sample: phase(master) = %.15f, phase(slave) = %.15f\n", master->frame_last_phase, cnetz->frame_last_phase);
|
||||
count--;
|
||||
samples--;
|
||||
cnetz->frame_last_phase = master->frame_last_phase;
|
||||
}
|
||||
/* if the sample count is one sample behind, we go forward one sample */
|
||||
if (count == master->frame_last_count - 1) {
|
||||
PDEBUG(DDSP, DEBUG_INFO, "Sync slave to master by going forth one sample: phase(master) = %.15, phase(slave) = %.15\n", master->frame_last_phase, cnetz->frame_last_phase);
|
||||
PDEBUG(DDSP, DEBUG_INFO, "Sync slave to master by going forth one sample: phase(master) = %.15f, phase(slave) = %.15f\n", master->frame_last_phase, cnetz->frame_last_phase);
|
||||
count++;
|
||||
*samples = samples[-1];
|
||||
samples++;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
@ -602,13 +603,13 @@ static void debug_parameter(char digit, uint64_t value)
|
|||
if (parameter->value_names)
|
||||
PDEBUG(DFRAME, DEBUG_DEBUG, " (%c) %s : %s\n", digit, parameter->param_name, parameter->value_names[value]);
|
||||
else if (parameter->bits == 64)
|
||||
PDEBUG(DFRAME, DEBUG_DEBUG, " (%c) %s : 0x%016x\n", digit, parameter->param_name, value);
|
||||
PDEBUG(DFRAME, DEBUG_DEBUG, " (%c) %s : 0x%016" PRIx64 "\n", digit, parameter->param_name, value);
|
||||
else if (digit == 'X') {
|
||||
char wahlziffern[17];
|
||||
decode_dialstring(wahlziffern, value);
|
||||
PDEBUG(DFRAME, DEBUG_DEBUG, " (%c) %s : '%s'\n", digit, parameter->param_name, wahlziffern);
|
||||
} else
|
||||
PDEBUG(DFRAME, DEBUG_DEBUG, " (%c) %s : %d\n", digit, parameter->param_name, value);
|
||||
PDEBUG(DFRAME, DEBUG_DEBUG, " (%c) %s : %" PRIu64 "\n", digit, parameter->param_name, value);
|
||||
}
|
||||
|
||||
/* encode telegram to 70 bits
|
||||
|
@ -806,7 +807,7 @@ static char *assemble_telegramm(const telegramm_t *telegramm, int debug)
|
|||
val >>= 1;
|
||||
}
|
||||
if (val)
|
||||
PDEBUG(DFRAME, DEBUG_ERROR, "Parameter '%c' value '0x%x' exceeds bit range!\n", parameter, value);
|
||||
PDEBUG(DFRAME, DEBUG_ERROR, "Parameter '%c' value '0x%" PRIx64 "' exceeds bit range!\n", parameter, value);
|
||||
i += j - 1;
|
||||
}
|
||||
bits[70] = '\0';
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#define PDEBUG(cat, level, fmt, arg...) _printdebug(__FILE__, __FUNCTION__, __LINE__, cat, level, -1, fmt, ## arg)
|
||||
#define PDEBUG_CHAN(cat, level, fmt, arg...) _printdebug(__FILE__, __FUNCTION__, __LINE__, cat, level, CHAN, fmt, ## arg)
|
||||
void _printdebug(const char *file, const char *function, int line, int cat, int level, int chan, const char *fmt, ...);
|
||||
void _printdebug(const char *file, const char *function, int line, int cat, int level, int chan, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 7, 8)));
|
||||
|
||||
const char *debug_amplitude(double level);
|
||||
|
||||
|
|
Loading…
Reference in New Issue