From 35e08aaa24bd01e6ace453f89ddb73a6bb0508b0 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 14 Feb 2017 01:00:33 -0500 Subject: Still not working, but getting closer to dynamic OOTX decoding. --- include/survive.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/survive.h b/include/survive.h index d2f5bfe..4a95a2f 100644 --- a/include/survive.h +++ b/include/survive.h @@ -10,6 +10,12 @@ struct SurviveContext; //DANGER: This structure may be redefined. Note that it is logically split into 64-bit chunks //for optimization on 32- and 64-bit systems. + +//Careful with this, you can't just add another one right now, would take minor changes in survive_data.c and the cal tools. +//It will also require a recompile. TODO: revisit this and correct the comment once fixed. +#define NUM_LIGHTHOUSES 2 + + struct SurviveObject { struct SurviveContext * ctx; @@ -32,10 +38,10 @@ struct SurviveObject //Flood info, for calculating which laser is currently sweeping. int8_t oldcode; - uint32_t last_time[2]; //0 = master, 1 = slave. Hardcoded, because it cannot simply be expanded. - uint32_t last_length[2]; - int8_t sync_set_number; //0 = master, 1 = slave, -1 = fault. Possibly more lighthouses??? - int8_t did_handle_ootx; + uint32_t last_time[NUM_LIGHTHOUSES]; + uint32_t last_length[NUM_LIGHTHOUSES]; + int8_t sync_set_number; //0 = master, 1 = slave, -1 = fault. + int8_t did_handle_ootx; //If unset, will send lightcap data for sync pulses next time a sensor is hit. uint32_t recent_sync_time; uint32_t last_lighttime; //May be a 24- or 32- bit number depending on what device. @@ -64,8 +70,15 @@ struct SurviveObject * survive_get_so_by_name( struct SurviveContext * ctx, cons //Utilitiy functions. int survive_simple_inflate( struct SurviveContext * ctx, const char * input, int inlen, char * output, int outlen ); -//TODO: Need to make this do haptic responses for hands. +//TODO: Need to make this do haptic responses for hands. int survive_usb_send_magic( struct SurviveContext * ctx, int on ); +//Install the calibrator. +void survive_cal_install( struct SurviveContext * ctx ); + +//Call these from your callback if overridden. +void survive_default_light_process( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); +void survive_default_imu_process( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id ); + #endif -- cgit v1.2.3