aboutsummaryrefslogtreecommitdiff
path: root/include
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 /include
parent6fbf801a0a1181861f82eab5af738a4290b21978 (diff)
downloadlibsurvive-a95737952d4fbb658b6de3bec312109b56caf6a6.tar.gz
libsurvive-a95737952d4fbb658b6de3bec312109b56caf6a6.tar.bz2
hacked in my disambiguator
Diffstat (limited to 'include')
-rw-r--r--include/disambiguator.h35
-rw-r--r--include/survive.h5
2 files changed, 40 insertions, 0 deletions
diff --git a/include/disambiguator.h b/include/disambiguator.h
new file mode 100644
index 0000000..58bce48
--- /dev/null
+++ b/include/disambiguator.h
@@ -0,0 +1,35 @@
+#ifndef DISAMBIGUATOR_H
+#define DISAMBIGUATOR_H
+
+#define DIS_NUM_VALUES 8
+
+typedef enum {
+ D_STATE_INVALID = 0,
+ D_STATE_LOCKED = 1,
+ D_STATE_UNLOCKED = -1,
+} dis_state;
+
+typedef enum {
+ P_UNKNOWN = 0,
+ P_SYNC = 1,
+ P_SWEEP = 2,
+} pulse_type;
+
+typedef struct disambiguator_ {
+ long times[DIS_NUM_VALUES];
+ int scores[DIS_NUM_VALUES];
+ dis_state state;
+ long last;
+ int max_confidence;
+ char code;
+} disambiguator;
+
+typedef struct classified_pulse_ {
+ pulse_type t;
+ int length;
+} classified_pulse;
+
+void disambiguator_init(disambiguator * d);
+pulse_type disambiguator_step(disambiguator * d, long time, int length);
+
+#endif /* DISAMBIGUATOR_H */ \ No newline at end of file
diff --git a/include/survive.h b/include/survive.h
index f64091f..e29c82b 100644
--- a/include/survive.h
+++ b/include/survive.h
@@ -1,6 +1,7 @@
#ifndef _SURVIVE_H
#define _SURVIVE_H
+#include "disambiguator.h"
#include <stdint.h>
#define SV_FLOAT double
@@ -31,10 +32,14 @@ struct SurviveObject
//Flood info, for calculating which laser is currently sweeping.
int8_t oldcode;
+#if 0
int16_t total_photos;
int32_t last_photo_time;
int32_t total_photo_time;
int32_t total_pulsecode_time;
+#else
+ disambiguator d;
+#endif
};
typedef void (*text_feedback_fnptr)( struct SurviveContext * ctx, const char * fault );