add code to use cnlohr's improved dataset
@@ -200,12 +200,69 @@ void acode_test() {
}
}
+void cnlohr_code_test() {
+ ootx_packet_clbk = my_test2;
+ ootx_bad_crc_clbk = bad_crc;
+
+ char* line = NULL;
+ size_t line_len = 0;
+ char trash[100] = "";
+// int32_t atime = 0x00;
+ int8_t lh_id = 0x00;
+ uint32_t ticks = 0x00;
+ int32_t delta = 0x00;
+// uint8_t acode = 0x00;
+// char lighthouse_code = '\0';
+
+// int8_t current_lighthouse = 0;
+ ootx_decoder_context *c_ctx = ctx;
+
+ while (getline(&line,&line_len,stdin)>0) {
+ //R Y HMD -1575410734 -2 7 19714 6485
+ sscanf(line,"%s %s %s %s %hhd %s %d %d",
+ trash,
+ trash,
+ trash,
+ trash,
+ &lh_id,
+ trash, //sensor id?
+ &delta,
+ &ticks);
+
+// int8_t lh = lighthouse_code=='R'?0:1;
+// printf("LH:%d %s\n", lh_id, line);
+ int8_t lh = (lh_id*-1)-1;
+ if (lh_id < 0) {
+// uint8_t bit = 0x01; //bit for debugging purposes
+
+ //change to newly found lighthouse
+ c_ctx = ctx+lh;
+
+// uint8_t dbit = ootx_decode_bit(ticks);
+// printf("LH:%d ticks:%d bit:%X %s", lh, ticks, dbit, line);
+
+ ootx_process_bit(c_ctx, ticks);
+
+/*
+ uint16_t s = *(c_ctx->payload_size);
+ uint16_t fwv = *(c_ctx->buffer+2);
+ uint16_t pv = 0x3f & fwv; //protocol version
+ fwv>>=6; //firmware version
+
+ //this will print after any messages from ootx_pump
+// if (c_ctx->found_preamble>0) printf("LH:%d s:%d 0x%x fw:%d pv:%d bo:%d bit:%d\t%s", current_lighthouse, s, s, fwv, pv, c_ctx->buf_offset, bit, line);
+*/
+ }
+ }
+}
+
int main(int argc, char* argv[])
{
ootx_init_decoder_context(ctx);
ootx_init_decoder_context(ctx+1);
- raw_test();
+ cnlohr_code_test();
+// raw_test();
// acode_test();
// hello_world_test();
