From fcf3528bfeba5e4646dbb0626a87c297d940a787 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Thu, 7 Jun 2018 23:42:05 -0600 Subject: Added debug message to ootx; mag reading to playback --- src/ootx_decoder.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ootx_decoder.c') diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c index 0620284..7d45626 100644 --- a/src/ootx_decoder.c +++ b/src/ootx_decoder.c @@ -19,11 +19,17 @@ #define MAX_BUFF_SIZE 64 +void (*ootx_error_clbk)(ootx_decoder_context *ctx, const char *msg) = NULL; void (*ootx_packet_clbk)(ootx_decoder_context * ctx, ootx_packet* packet) = NULL; void (*ootx_bad_crc_clbk)(ootx_decoder_context * ctx, ootx_packet* packet, uint32_t crc) = NULL; void ootx_pump_bit(ootx_decoder_context *ctx, uint8_t dbit); +void ootx_error(ootx_decoder_context *ctx, const char *msg) { + if (ootx_error_clbk) + ootx_error_clbk(ctx, msg); +} + void ootx_init_decoder_context(ootx_decoder_context *ctx) { ctx->buf_offset = 0; ctx->bits_written = 0; @@ -106,7 +112,7 @@ void ootx_pump_bit(ootx_decoder_context *ctx, uint8_t dbit) { if ( ootx_detect_preamble(ctx, dbit) ) { /* data stream can start over at any time so we must always look for preamble bits */ - //printf("Preamble found\n"); + ootx_error(ctx, "Preamble found"); ootx_reset_buffer(ctx); ctx->bits_processed = 0; ctx->found_preamble = 1; @@ -117,6 +123,7 @@ void ootx_pump_bit(ootx_decoder_context *ctx, uint8_t dbit) { if( !dbit ) { //printf("Bad sync bit\n"); + ootx_error(ctx, "OOTX Decoder: Bad sync bit"); ootx_reset_buffer(ctx); } ctx->bits_processed = 0; -- cgit v1.2.3