From cc79e01f62be87f7dcc6de3be7ddb981d6899dff Mon Sep 17 00:00:00 2001 From: Josh Allen Date: Sun, 12 Feb 2017 08:34:01 -0500 Subject: ootx_log_bit to ootx_accumulate_bit --- tools/ootx_decode/ootx_decoder.c | 12 +++++++++--- tools/ootx_decode/ootx_decoder.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/ootx_decode/ootx_decoder.c b/tools/ootx_decode/ootx_decoder.c index 6a06744..c244b80 100644 --- a/tools/ootx_decode/ootx_decoder.c +++ b/tools/ootx_decode/ootx_decoder.c @@ -84,19 +84,24 @@ uint8_t ootx_decode_bit(uint32_t ticks) { return bits&0x02; } */ - -void ootx_log_bit(ootx_decoder_context *ctx, uint32_t ticks) { - int8_t dbit = ootx_decode_bit(ticks); +/* +void ootx_accumulate_bit(ootx_decoder_context *ctx, uint32_t ticks) { + uint8_t dbit = ootx_decode_bit(ticks); // printf("%d\n\n", dbit); ctx->bit_count[(dbit&0x01)]++; // printf("%d %d %d\n", dbit, ctx->bit_count[0], ctx->bit_count[1]); } +*/ +void ootx_accumulate_bit(ootx_decoder_context *ctx, uint8_t bit) { + ctx->bit_count[bit&0x01]++; +} uint8_t ootx_pump_greatest_bit(ootx_decoder_context *ctx) { //pump the bit uint8_t bit = 0x00; if (ctx->bit_count[0] < ctx->bit_count[1]) bit = 0xFF; +// printf("pump %d\n", bit); ootx_pump_bit( ctx, bit ); ctx->bit_count[0] = 0; @@ -150,6 +155,7 @@ void ootx_write_to_buffer(ootx_decoder_context *ctx, uint8_t dbit) { void ootx_process_bit(ootx_decoder_context *ctx, uint32_t length) { int8_t dbit = ootx_decode_bit(length); + ootx_pump_bit( ctx, dbit ); } diff --git a/tools/ootx_decode/ootx_decoder.h b/tools/ootx_decode/ootx_decoder.h index c7cf55c..7e6af82 100644 --- a/tools/ootx_decode/ootx_decoder.h +++ b/tools/ootx_decode/ootx_decoder.h @@ -60,7 +60,7 @@ void ootx_process_bit(ootx_decoder_context *ctx, uint32_t length); void ootx_init_decoder_context(ootx_decoder_context *ctx); int8_t ootx_decode_lighthouse_number(uint8_t last_num, uint32_t ticks, int32_t delta); -void ootx_log_bit(ootx_decoder_context *ctx, uint32_t length); +void ootx_accumulate_bit(ootx_decoder_context *ctx, uint8_t bit); uint8_t ootx_pump_greatest_bit(ootx_decoder_context *ctx); extern void (*ootx_packet_clbk)(ootx_packet* packet); -- cgit v1.2.3