From 7bde86f6fcbf727fc9ee3c11d5f6a01ad4233a32 Mon Sep 17 00:00:00 2001 From: "David E. Tiller" <3858971+dtiller@users.noreply.github.com> Date: Fri, 18 Mar 2022 20:43:45 -0400 Subject: [PATCH] #ifdef'ed debugging. --- src/eotd.c | 3 ++- src/hdlc_rec.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/eotd.c b/src/eotd.c index 91f0110..96c3731 100644 --- a/src/eotd.c +++ b/src/eotd.c @@ -61,9 +61,10 @@ void eotd_to_nmea (unsigned char *eotd, int eotd_len, char *nmea, int nmea_size) { + *nmea = '\0'; for (int i = 0; i < eotd_len; i++) { char temp[32]; snprintf(temp, sizeof(temp), "%d=%02x ", i, eotd[i]); - strlcpy(nmea, temp, nmea_size); + strlcat(nmea, temp, nmea_size); } } diff --git a/src/hdlc_rec.c b/src/hdlc_rec.c index 85879e1..89887f9 100644 --- a/src/hdlc_rec.c +++ b/src/hdlc_rec.c @@ -439,7 +439,9 @@ static void eotd_rec_bit (int chan, int subchan, int slice, int raw, int future_ */ H = &hdlc_state[chan][subchan][slice]; +#ifdef DETDEBUG fprintf(stderr, "chan=%d subchan=%d slice=%d raw=%d\n", chan, subchan, slice, raw); +#endif //dw_printf ("slice %d = %d\n", slice, raw); // Accumulate most recent 32 bits in MSB-first order. @@ -460,7 +462,9 @@ fprintf(stderr, "chan=%d subchan=%d slice=%d raw=%d\n", chan, subchan, slice, ra /* Hack to skip 'dummy' 64th bit */ if (H->olen == 7 && H->frame_len == 7) { +#ifdef DETDEBUG fprintf(stderr, "Special case!\n"); +#endif H->eotd_acc <<= 1; H->olen++; } @@ -474,7 +478,9 @@ fprintf(stderr, "Special case!\n"); if (H->frame_len == EOTD_MAX_LEN) { // FIXME: look for other places with max length done = 1; +#ifdef DETDEBUG for (int ii=0; ii < EOTD_MAX_LEN; ii++) {fprintf(stderr, "%02x ", H->frame_buf[ii]); } fprintf(stderr, "\n"); +#endif } } }