NMT: Show debugging for IDLE frames

Suppress repeated IDLE frame
This commit is contained in:
Andreas Eversberg 2022-06-12 09:45:55 +02:00
parent 6f84314b93
commit 181617aa81
2 changed files with 12 additions and 3 deletions

View File

@ -1627,7 +1627,7 @@ const char *nmt_get_frame(nmt_t *nmt)
{
frame_t frame;
const char *bits;
int debug = 1;
int last_frame_idle, debug = 1;
memset(&frame, 0, sizeof(frame));
@ -1681,13 +1681,18 @@ const char *nmt_get_frame(nmt_t *nmt)
break;
}
last_frame_idle = nmt->tx_last_frame_idle;
nmt->tx_last_frame_idle = 0;
/* no encoding debug for certain (idle) frames */
switch(frame.mt) {
case NMT_MESSAGE_1a:
case NMT_MESSAGE_4:
case NMT_MESSAGE_1b:
case NMT_MESSAGE_30:
if (last_frame_idle)
debug = 0;
nmt->tx_last_frame_idle = 1;
break;
default:
break;
@ -1699,7 +1704,10 @@ const char *nmt_get_frame(nmt_t *nmt)
bits = encode_frame(nmt->sysinfo.system, &frame, debug);
if (debug)
PDEBUG_CHAN(DNMT, DEBUG_DEBUG, "Sending frame %s.\n", nmt_frame_name(frame.mt));
if (debug && nmt->tx_last_frame_idle)
PDEBUG_CHAN(DNMT, DEBUG_DEBUG, "Subsequent IDLE frames are not show, to prevent flooding the output.\n");
return bits;
}

View File

@ -131,6 +131,7 @@ struct nmt {
char tx_frame[166]; /* 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 */
/* DMS/SMS states */
dms_t dms; /* DMS states */