aboutsummaryrefslogtreecommitdiff
path: root/src/survive_data.c
diff options
context:
space:
mode:
authorJulian Picht <julian.picht@gmail.com>2016-12-20 21:32:44 +0100
committerJulian Picht <julian.picht@gmail.com>2016-12-20 21:32:44 +0100
commita95737952d4fbb658b6de3bec312109b56caf6a6 (patch)
tree8012b1a602528ae873d2793a2bc571e148a764e6 /src/survive_data.c
parent6fbf801a0a1181861f82eab5af738a4290b21978 (diff)
downloadlibsurvive-a95737952d4fbb658b6de3bec312109b56caf6a6.tar.gz
libsurvive-a95737952d4fbb658b6de3bec312109b56caf6a6.tar.bz2
hacked in my disambiguator
Diffstat (limited to 'src/survive_data.c')
-rw-r--r--src/survive_data.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/survive_data.c b/src/survive_data.c
index 660c3e1..fc86d9f 100644
--- a/src/survive_data.c
+++ b/src/survive_data.c
@@ -11,6 +11,7 @@
//All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses.
#include "survive_internal.h"
+#include "disambiguator.h"
#include <stdint.h>
#include <string.h>
@@ -41,6 +42,21 @@ static void handle_lightcap( struct SurviveObject * so, struct LightcapElement *
if( le->type != 0xfe || le->length < 50 ) return;
//le->timestamp += (le->length/2);
+ int32_t offset = le->timestamp - so->d.last;
+ switch(disambiguator_step(&(so->d), le->timestamp, le->length)) {
+ default:
+ case P_UNKNOWN:
+ // not currently locked
+ case P_SYNC:
+ ct->lightproc( so, le->sensor_id, -1, 0, le->timestamp, offset );
+ so->d.code = ((le->length+125)/250) - 12;
+ break;
+ case P_SWEEP:
+ if (so->d.gcode & 1) return;
+ ct->lightproc( so, le->sensor_id, so->d.code >> 1, offset, le->timestamp, le->length );
+ break;
+ }
+#if 0
if( le->length > 2100 ) //Pulse longer indicates a sync pulse.
{
int32_t deltat = (uint32_t)le->timestamp - (uint32_t)so->last_photo_time;
@@ -85,6 +101,7 @@ static void handle_lightcap( struct SurviveObject * so, struct LightcapElement *
{
//Runt pulse.
}
+#endif
}