From bf87e5dbcffd65997292433041e664d001dbff8d Mon Sep 17 00:00:00 2001 From: cnlohr Date: Fri, 2 Dec 2016 01:38:29 -0500 Subject: Cleanup data processing --- src/survive_data.c | 12 +++++++++++- src/survive_internal.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/survive_data.c b/src/survive_data.c index 256c6d6..10c51bb 100644 --- a/src/survive_data.c +++ b/src/survive_data.c @@ -247,14 +247,24 @@ void survive_data_cb( struct SurviveUSBInterface * si ) case USB_IF_LIGHTHOUSE: { int i; + //printf( "%d -> ", size ); for( i = 0; i < 3; i++ ) { //handle_lightdata( (struct LightpulseStructure *)readdata ); int16_t * acceldata = (int16_t*)readdata; readdata += 12; uint32_t timecode = POP4; - survive_imu_process( &ctx->headset, acceldata, timecode, POP1 ); + uint8_t code = POP1; + //printf( "%d ", code ); + int8_t cd = code - ctx->oldcode; + + if( cd > 0 ) + { + ctx->oldcode = code; + survive_imu_process( &ctx->headset, acceldata, timecode, code ); + } } + //printf("\n" ); break; } case USB_IF_WATCHMAN1: diff --git a/src/survive_internal.h b/src/survive_internal.h index c3f8df3..ac45857 100644 --- a/src/survive_internal.h +++ b/src/survive_internal.h @@ -70,6 +70,7 @@ struct SurviveContext struct SurviveUSBInterface uiface[MAX_INTERFACES]; //Flood info, for calculating which laser is currently sweeping. + int8_t oldcode; int32_t last_photo_time; short total_photos; int32_t total_photo_time; -- cgit v1.2.3