From b2eb7569a8963917116c4520e15b17f0578a2509 Mon Sep 17 00:00:00 2001 From: Mike Turvey Date: Mon, 15 Jan 2018 22:40:14 -0700 Subject: Fix a few warnings --- src/ootx_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ootx_decoder.c') diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c index f7a7938..7bf7d7e 100644 --- a/src/ootx_decoder.c +++ b/src/ootx_decoder.c @@ -44,7 +44,7 @@ void ootx_free_decoder_context(ootx_decoder_context *ctx) { } uint8_t ootx_decode_bit(uint32_t length) { - uint8_t t = (length - 2750) / 500; //why 2750? + uint8_t t = (uint8_t)((length - 2750) / 500); //why 2750? // return ((t & 0x02)>0)?0xFF:0x00; //easier if we need to bitshift right return ((t & 0x02)>>1); } -- cgit v1.2.3 From 9a9a539396c622246a527ed0c12df36edf5ff807 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Fri, 23 Feb 2018 23:15:31 -0700 Subject: Fixed unaligned access issues --- src/ootx_decoder.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ootx_decoder.c') diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c index 7bf7d7e..ad55f5b 100644 --- a/src/ootx_decoder.c +++ b/src/ootx_decoder.c @@ -182,8 +182,13 @@ union iFloat { float f; }; + +struct __attribute__((__packed__)) unaligned_16_t { + uint16_t v; +}; + float _half_to_float(uint8_t* data) { - uint16_t x = *(uint16_t*)data; + uint16_t x = ((struct unaligned_16_t*)data)->v; union iFloat fnum; fnum.f = 0; -- cgit v1.2.3 From 48e32da8ec20f8f4df934e2de8ebe4385b483c51 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Sun, 4 Mar 2018 18:51:32 -0700 Subject: Fixed inadvertent change to signedness of acceldata --- src/ootx_decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ootx_decoder.c') diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c index ad55f5b..b7327d5 100644 --- a/src/ootx_decoder.c +++ b/src/ootx_decoder.c @@ -183,12 +183,12 @@ union iFloat { }; -struct __attribute__((__packed__)) unaligned_16_t { +struct __attribute__((__packed__)) unaligned_u16_t { uint16_t v; }; float _half_to_float(uint8_t* data) { - uint16_t x = ((struct unaligned_16_t*)data)->v; + uint16_t x = ((struct unaligned_u16_t*)data)->v; union iFloat fnum; fnum.f = 0; -- cgit v1.2.3