aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoshua Allen <axlecrusher@gmail.com>2017-03-12 19:04:27 -0400
committerJoshua Allen <axlecrusher@gmail.com>2017-03-12 19:04:27 -0400
commitccf6f01bb9365b5c433c877a8f59ee8153017d43 (patch)
tree9b93953017113f173c23605a0f9458c2115b2a96 /src
parentb528f822966cf8978cbe28936ae1f15c3032e1d2 (diff)
downloadlibsurvive-ccf6f01bb9365b5c433c877a8f59ee8153017d43.tar.gz
libsurvive-ccf6f01bb9365b5c433c877a8f59ee8153017d43.tar.bz2
save config after ootx data is completed
Diffstat (limited to 'src')
-rw-r--r--src/survive_cal.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/survive_cal.c b/src/survive_cal.c
index 1376ee4..f810098 100644
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -31,6 +31,8 @@ static void reset_calibration( struct SurviveCalData * cd );
void ootx_packet_clbk_d(ootx_decoder_context *ct, ootx_packet* packet)
{
+ static uint8_t lighthouses_completed = 0;
+
SurviveContext * ctx = (SurviveContext*)(ct->user);
SurviveCalData * cd = ctx->calptr;
int id = ct->user1;
@@ -57,7 +59,11 @@ void ootx_packet_clbk_d(ootx_decoder_context *ct, ootx_packet* packet)
b->OOTXSet = 1;
config_set_lighthouse(ctx->lh_config,b,id);
-// config_save("config.json");
+ lighthouses_completed++;
+
+ if (lighthouses_completed >= NUM_LIGHTHOUSES) {
+ config_save(ctx, "config.json");
+ }
}
int survive_cal_get_status( struct SurviveContext * ctx, char * description, int description_length )