aboutsummaryrefslogtreecommitdiff
path: root/src/survive_data.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2016-12-15 22:35:51 -0500
committercnlohr <lohr85@gmail.com>2016-12-15 22:35:51 -0500
commit890a3addcc936229541626e6748fadd142f58a6e (patch)
tree654e761392f0387a59f903fa66eaaf935739065a /src/survive_data.c
parentbe571a486992bf01ddf72b536b7c3bc47a87cc78 (diff)
downloadlibsurvive-890a3addcc936229541626e6748fadd142f58a6e.tar.gz
libsurvive-890a3addcc936229541626e6748fadd142f58a6e.tar.bz2
rework some of the way we display data and the way magic codes are sent.
Diffstat (limited to 'src/survive_data.c')
-rw-r--r--src/survive_data.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/survive_data.c b/src/survive_data.c
index 11677e0..c84ab09 100644
--- a/src/survive_data.c
+++ b/src/survive_data.c
@@ -41,11 +41,14 @@ static void handle_lightcap( struct SurviveObject * so, struct LightcapElement *
int32_t deltat = (uint32_t)le->timestamp - (uint32_t)ct->last_photo_time;
if( deltat > 2000 || deltat < -2000 ) //New pulse. (may be inverted)
{
- ct->last_photo_time = le->timestamp;
- ct->total_photo_time = 0;
- ct->total_photos = 0;
- ct->total_pulsecode_time = 0;
- survive_light_process( so, le->sensor_id, -1, 0, le->timestamp );
+ if( le->timestamp - ct->last_photo_time > 80000 )
+ {
+ ct->last_photo_time = le->timestamp;
+ ct->total_photo_time = 0;
+ ct->total_photos = 0;
+ ct->total_pulsecode_time = 0;
+ survive_light_process( so, le->sensor_id, -1, 0, le->timestamp, deltat );
+ }
}
else
{
@@ -54,7 +57,7 @@ static void handle_lightcap( struct SurviveObject * so, struct LightcapElement *
ct->total_photos++;
}
}
- else if( le->length < 900 && le->length > 50 && ct->total_photos )
+ else if( le->length < 1200 && le->length > 40 && ct->total_photos )
{
int32_t dl = (ct->total_photo_time/ct->total_photos);
int32_t tpco = (ct->total_pulsecode_time/ct->total_photos);
@@ -70,7 +73,7 @@ static void handle_lightcap( struct SurviveObject * so, struct LightcapElement *
if( offset_from < 380000 )
{
- survive_light_process( so, le->sensor_id, acode, offset_from, le->timestamp );
+ survive_light_process( so, le->sensor_id, acode, offset_from, le->timestamp, le->length );
}
}
else