aboutsummaryrefslogtreecommitdiff
path: root/src/ootx_decoder.c
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-06-07 23:42:05 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-06-07 23:42:05 -0600
commitfcf3528bfeba5e4646dbb0626a87c297d940a787 (patch)
tree8aebd196ab090cef2d2b96a017f86d242c667f9a /src/ootx_decoder.c
parent9224b6e2ce9747f09d154be2117a43f0d14511ac (diff)
downloadlibsurvive-fcf3528bfeba5e4646dbb0626a87c297d940a787.tar.gz
libsurvive-fcf3528bfeba5e4646dbb0626a87c297d940a787.tar.bz2
Added debug message to ootx; mag reading to playback
Diffstat (limited to 'src/ootx_decoder.c')
-rw-r--r--src/ootx_decoder.c9
1 files changed, 8 insertions, 1 deletions
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;