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/survive_vive.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/survive_vive.c') diff --git a/src/survive_vive.c b/src/survive_vive.c index 5be2d03..cb05efc 100755 --- a/src/survive_vive.c +++ b/src/survive_vive.c @@ -903,15 +903,20 @@ int survive_get_config( char ** config, SurviveViveData * sv, int devno, int ifa #define POP1 (*(readdata++)) - struct __attribute__((__packed__)) unaligned_16_t { - uint16_t v; + int16_t v; }; struct __attribute__((__packed__)) unaligned_32_t { + int32_t v; +}; +struct __attribute__((__packed__)) unaligned_u16_t { + uint16_t v; +}; +struct __attribute__((__packed__)) unaligned_u32_t { uint32_t v; }; -#define POP2 ((((( struct unaligned_16_t*)((readdata+=2)-2))))->v) -#define POP4 ((((( struct unaligned_32_t*)((readdata+=4)-4))))->v) +#define POP2 ((((( struct unaligned_u16_t*)((readdata+=2)-2))))->v) +#define POP4 ((((( struct unaligned_u32_t*)((readdata+=4)-4))))->v) void calibrate_acc(SurviveObject* so, FLT* agm) { if (so->acc_bias != NULL) { -- cgit v1.2.3