diff options
author | cnlohr <lohr85@gmail.com> | 2016-12-02 01:38:29 -0500 |
---|---|---|
committer | cnlohr <lohr85@gmail.com> | 2016-12-02 01:38:29 -0500 |
commit | bf87e5dbcffd65997292433041e664d001dbff8d (patch) | |
tree | f6ea5178ab3d3371f3fbc101b5682b0cfc7146ad /src/survive_data.c | |
parent | eb7a93cefc958421d3bebbedc1163c73ae2e2778 (diff) | |
download | libsurvive-bf87e5dbcffd65997292433041e664d001dbff8d.tar.gz libsurvive-bf87e5dbcffd65997292433041e664d001dbff8d.tar.bz2 |
Cleanup data processing
Diffstat (limited to 'src/survive_data.c')
-rw-r--r-- | src/survive_data.c | 12 |
1 files changed, 11 insertions, 1 deletions
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: |