aboutsummaryrefslogtreecommitdiff
path: root/src/ootx_decoder.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2018-06-23 12:11:33 -0400
committercnlohr <lohr85@gmail.com>2018-06-23 12:11:33 -0400
commit9291b950c5508513ea261059229e19760c050a47 (patch)
tree2cb0217e67896382c3bc395ad91d438c779a32cf /src/ootx_decoder.c
parent86bbd12c3889db3290e22ff61934ca1a218ce114 (diff)
parent87b6229f6fc4e434b9472e6c7722e40497ac97a1 (diff)
downloadlibsurvive-9291b950c5508513ea261059229e19760c050a47.tar.gz
libsurvive-9291b950c5508513ea261059229e19760c050a47.tar.bz2
Merge branch 'master' into new_config_system
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;