R2000: Show debugging for IDLE frames

Suppress repeated IDLE frame
This commit is contained in:
Andreas Eversberg 2022-06-12 09:47:05 +02:00
parent 181617aa81
commit 641ba0881f
2 changed files with 12 additions and 3 deletions

View File

@ -1153,7 +1153,7 @@ const char *r2000_get_frame(r2000_t *r2000)
{ {
frame_t frame; frame_t frame;
const char *bits; const char *bits;
int debug = 1; int last_frame_idle, debug = 1;
r2000->tx_frame_count++; r2000->tx_frame_count++;
@ -1165,11 +1165,16 @@ const char *r2000_get_frame(r2000_t *r2000)
frame.sm_power = r2000->sysinfo.sm_power; frame.sm_power = r2000->sysinfo.sm_power;
frame.taxe = r2000->sysinfo.taxe; frame.taxe = r2000->sysinfo.taxe;
last_frame_idle = r2000->tx_last_frame_idle;
r2000->tx_last_frame_idle = 0;
switch (r2000->state) { switch (r2000->state) {
case STATE_IDLE: case STATE_IDLE:
case STATE_RECALL_WAIT: case STATE_RECALL_WAIT:
tx_idle(r2000, &frame); tx_idle(r2000, &frame);
debug = 0; if (last_frame_idle)
debug = 0;
r2000->tx_last_frame_idle = 1;
break; break;
case STATE_INSCRIPTION: case STATE_INSCRIPTION:
tx_inscription(r2000, &frame); tx_inscription(r2000, &frame);
@ -1217,7 +1222,10 @@ const char *r2000_get_frame(r2000_t *r2000)
bits = encode_frame(&frame, debug); bits = encode_frame(&frame, debug);
PDEBUG_CHAN(DR2000, DEBUG_DEBUG, "Sending frame %s.\n", r2000_frame_name(frame.message, REL_TO_SM)); if (debug)
PDEBUG_CHAN(DR2000, DEBUG_DEBUG, "Sending frame %s.\n", r2000_frame_name(frame.message, REL_TO_SM));
if (debug && r2000->tx_last_frame_idle)
PDEBUG_CHAN(DR2000, DEBUG_DEBUG, "Subsequent IDLE frames are not show, to prevent flooding the output.\n");
return bits; return bits;
} }

View File

@ -90,6 +90,7 @@ typedef struct r2000 {
char tx_frame[208]; /* carries bits of one frame to transmit */ char tx_frame[208]; /* carries bits of one frame to transmit */
int tx_frame_length; int tx_frame_length;
int tx_frame_pos; int tx_frame_pos;
int tx_last_frame_idle; /* indicator to prevent debugging all idle frames */
uint16_t rx_sync; /* shift register to detect sync */ uint16_t rx_sync; /* shift register to detect sync */
int rx_in_sync; /* if we are in sync and receive bits */ int rx_in_sync; /* if we are in sync and receive bits */
int rx_mute; /* mute count down after sync */ int rx_mute; /* mute count down after sync */