NMT: Show debugging for IDLE frames

Suppress repeated IDLE frame
pull/6/head
Andreas Eversberg 6 months ago
parent 6f84314b93
commit 181617aa81
  1. 14
      src/nmt/nmt.c
  2. 1
      src/nmt/nmt.h

@ -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:
debug = 0;
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);
PDEBUG_CHAN(DNMT, DEBUG_DEBUG, "Sending frame %s.\n", nmt_frame_name(frame.mt));
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;
}

@ -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 */

Loading…
Cancel
Save