aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Turvey <mwturvey@users.noreply.github.com>2017-12-19 23:36:46 -0700
committerGitHub <noreply@github.com>2017-12-19 23:36:46 -0700
commit7c883ad2f01a452b3a0664deed12c0121429092a (patch)
tree5a47b9c9403ac2d37dee3b449cd5d353d47014fd
parente5a9bff729fb0c596daed5cdf45683e11c666766 (diff)
parenta015a5bc3631f813281c5af85a29b9d84a3eb924 (diff)
downloadlibsurvive-7c883ad2f01a452b3a0664deed12c0121429092a.tar.gz
libsurvive-7c883ad2f01a452b3a0664deed12c0121429092a.tar.bz2
Merge pull request #82 from mwturvey/SupportOneLighthouse
Add support for using only 1 lighthouse
-rw-r--r--calibrate.c2
-rw-r--r--include/libsurvive/survive.h1
-rwxr-xr-xsrc/survive.c2
-rwxr-xr-xsrc/survive_cal.c4
4 files changed, 7 insertions, 2 deletions
diff --git a/calibrate.c b/calibrate.c
index 15c362c..88f8288 100644
--- a/calibrate.c
+++ b/calibrate.c
@@ -14,6 +14,7 @@
struct SurviveContext * ctx;
int quit = 0;
+static LighthouseCount = 0;
void HandleKey( int keycode, int bDown )
{
@@ -343,6 +344,7 @@ void * SurviveThread(void *jnk)
{
ctx = survive_init( 0 );
+
uint8_t i =0;
for (i=0;i<32;++i) {
sensor_name[i] = malloc(3);
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index 1532d62..c4b2abe 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -102,6 +102,7 @@ struct SurviveContext
struct config_group* lh_config; //lighthouse configs
//Calibration data:
+ int activeLighthouses;
BaseStationData bsd[NUM_LIGHTHOUSES];
SurviveCalData * calptr; //If and only if the calibration subsystem is attached.
diff --git a/src/survive.c b/src/survive.c
index f637bd8..0c88137 100755
--- a/src/survive.c
+++ b/src/survive.c
@@ -75,6 +75,8 @@ SurviveContext * survive_init( int headless )
config_read(ctx, "config.json");
+ ctx->activeLighthouses = config_read_uint32(ctx->global_config_values, "LighthouseCount", 2);
+
ctx->faultfunction = survivefault;
ctx->notefunction = survivenote;
diff --git a/src/survive_cal.c b/src/survive_cal.c
index ae92bad..0dbadd3 100755
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -218,7 +218,7 @@ void survive_cal_light( struct SurviveObject * so, int sensor_id, int acode, int
int i;
for( i = 0; i < NUM_LIGHTHOUSES; i++ )
if( ctx->bsd[i].OOTXSet == 0 ) break;
- if( i == NUM_LIGHTHOUSES ) cd->stage = 2; //TODO: Make this configuratble to allow single lighthouse.
+ if( i == ctx->activeLighthouses ) cd->stage = 2; //TODO: Make this configuratble to allow single lighthouse.
}
break;
case 3: //Look for light sync lengths.
@@ -309,7 +309,7 @@ void survive_cal_angle( struct SurviveObject * so, int sensor_id, int acode, uin
cd->found_common = 1;
for( i = 0; i < cd->numPoseObjects; i++ )
//for( i = 0; i < MAX_SENSORS_TO_CAL/SENSORS_PER_OBJECT; i++ )
- for( j = 0; j < NUM_LIGHTHOUSES; j++ )
+ for( j = 0; j < ctx->activeLighthouses; j++ )
{
int sensors_visible = 0;
for( k = 0; k < SENSORS_PER_OBJECT; k++ )