aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2016-12-02 01:38:29 -0500
committercnlohr <lohr85@gmail.com>2016-12-02 01:38:29 -0500
commitbf87e5dbcffd65997292433041e664d001dbff8d (patch)
treef6ea5178ab3d3371f3fbc101b5682b0cfc7146ad /src
parenteb7a93cefc958421d3bebbedc1163c73ae2e2778 (diff)
downloadlibsurvive-bf87e5dbcffd65997292433041e664d001dbff8d.tar.gz
libsurvive-bf87e5dbcffd65997292433041e664d001dbff8d.tar.bz2
Cleanup data processing
Diffstat (limited to 'src')
-rw-r--r--src/survive_data.c12
-rw-r--r--src/survive_internal.h1
2 files changed, 12 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:
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;