From b77762780f00bd39da75371905e88db4ee668b96 Mon Sep 17 00:00:00 2001 From: wb2osz Date: Tue, 21 Sep 2021 13:00:36 -0400 Subject: [PATCH] More debug code. --- src/demod_afsk.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/demod_afsk.c b/src/demod_afsk.c index c34d8bc..ebf51fc 100644 --- a/src/demod_afsk.c +++ b/src/demod_afsk.c @@ -25,6 +25,8 @@ // #define DEBUG4 1 /* capture AFSK demodulator output to log files */ /* Can be used to make nice plots. */ +// #define DEBUG5 1 // Write just demodulated bit stream to file. */ + /*------------------------------------------------------------------ * @@ -875,6 +877,24 @@ static void nudge_pll (int chan, int subchan, int slice, float demod_out, struct int quality = fabsf(demod_out) * 100.0f / amplitude; if (quality > 100) quality = 100; +#if DEBUG5 + // Write bit stream to a file. + + static FILE *bsfp = NULL; + static int bcount = 0; + if (chan == 0 && subchan == 0 && slice == 0) { + if (bsfp == NULL) { + bsfp = fopen ("bitstream.txt", "w"); + } + fprintf (bsfp, "%d", demod_out > 0); + bcount++; + if (bcount % 64 == 0) { + fprintf (bsfp, "\n"); + } + } + +#endif + hdlc_rec_bit (chan, subchan, slice, demod_out > 0, 0, quality); pll_dcd_each_symbol2 (D, chan, subchan, slice); }