From 641ba0881fd018a72d3d75e38adbb15fef403491 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 12 Jun 2022 09:47:05 +0200 Subject: [PATCH] R2000: Show debugging for IDLE frames Suppress repeated IDLE frame --- src/r2000/r2000.c | 14 +++++++++++--- src/r2000/r2000.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/r2000/r2000.c b/src/r2000/r2000.c index 1b3013f..ec5f5e7 100644 --- a/src/r2000/r2000.c +++ b/src/r2000/r2000.c @@ -1153,7 +1153,7 @@ const char *r2000_get_frame(r2000_t *r2000) { frame_t frame; const char *bits; - int debug = 1; + int last_frame_idle, debug = 1; r2000->tx_frame_count++; @@ -1165,11 +1165,16 @@ const char *r2000_get_frame(r2000_t *r2000) frame.sm_power = r2000->sysinfo.sm_power; frame.taxe = r2000->sysinfo.taxe; + last_frame_idle = r2000->tx_last_frame_idle; + r2000->tx_last_frame_idle = 0; + switch (r2000->state) { case STATE_IDLE: case STATE_RECALL_WAIT: tx_idle(r2000, &frame); - debug = 0; + if (last_frame_idle) + debug = 0; + r2000->tx_last_frame_idle = 1; break; case STATE_INSCRIPTION: tx_inscription(r2000, &frame); @@ -1217,7 +1222,10 @@ const char *r2000_get_frame(r2000_t *r2000) 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; } diff --git a/src/r2000/r2000.h b/src/r2000/r2000.h index 07d7c1b..2d9d07c 100644 --- a/src/r2000/r2000.h +++ b/src/r2000/r2000.h @@ -90,6 +90,7 @@ typedef struct r2000 { char tx_frame[208]; /* carries bits of one frame to transmit */ int tx_frame_length; 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 */ int rx_in_sync; /* if we are in sync and receive bits */ int rx_mute; /* mute count down after sync */