aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/ootx_decode/Makefile4
-rw-r--r--tools/ootx_decode/ootx_decode.c17
2 files changed, 11 insertions, 10 deletions
diff --git a/tools/ootx_decode/Makefile b/tools/ootx_decode/Makefile
index 9170ac4..b3b07b4 100644
--- a/tools/ootx_decode/Makefile
+++ b/tools/ootx_decode/Makefile
@@ -3,5 +3,5 @@ all: ootx_decode hmd_datagen
hmd_datagen: HMD_Datagen.c
gcc -Wall HMD_Datagen.c -lz -o hmd_datagen
-ootx_decode: ootx_decode.c ootx_decoder.c ootx_decoder.h
- gcc -Wall ootx_decode.c ootx_decoder.c -lz -o ootx_decode
+ootx_decode: ootx_decode.c ../../src/ootx_decoder.c ../../src/ootx_decoder.h
+ gcc -Wall ootx_decode.c ../../src/ootx_decoder.c -lz -o ootx_decode -I ../../src/
diff --git a/tools/ootx_decode/ootx_decode.c b/tools/ootx_decode/ootx_decode.c
index 1074698..1823aaa 100644
--- a/tools/ootx_decode/ootx_decode.c
+++ b/tools/ootx_decode/ootx_decode.c
@@ -12,12 +12,12 @@
#include "ootx_decoder.h"
-void my_test(ootx_packet* packet) {
+void my_test(ootx_decoder_context *ctx, ootx_packet* packet) {
packet->data[packet->length] = 0;
printf("%d %s 0x%X\n", packet->length, packet->data, packet->crc32);
}
-void my_test2(ootx_packet* packet) {
+void my_test2(ootx_decoder_context *ctx, ootx_packet* packet) {
printf("completed ootx packet\n");
lighthouse_info_v6 lhi;
@@ -41,7 +41,7 @@ void write_to_file(uint8_t *d, uint16_t length){
fclose(fp);
}
-void bad_crc(ootx_packet* packet, uint32_t crc) {
+void bad_crc(ootx_decoder_context *ctx, ootx_packet* packet, uint32_t crc) {
printf("CRC mismatch\n");
printf("r:");
@@ -64,18 +64,19 @@ void cnlohr_code_test() {
int8_t lh_id = 0x00;
uint32_t ticks = 0x00;
int32_t delta = 0x00;
+ uint8_t acode = 0x00;
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",
+ sscanf(line,"%s %s %s %s %hhd %hhd %d %d",
trash,
trash,
trash,
trash,
&lh_id,
- trash, //sensor id?
+ &acode,
&delta,
&ticks);
@@ -91,8 +92,8 @@ void cnlohr_code_test() {
// 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);
-
+// ootx_process_bit(c_ctx, ticks);
+ ootx_pump_bit( c_ctx, (acode&0x02)>>1 );
/*
uint16_t s = *(c_ctx->payload_size);
uint16_t fwv = *(c_ctx->buffer+2);
@@ -117,4 +118,4 @@ int main(int argc, char* argv[])
ootx_free_decoder_context(ctx+1);
return 0;
-} \ No newline at end of file
+}