From ccf6f01bb9365b5c433c877a8f59ee8153017d43 Mon Sep 17 00:00:00 2001 From: Joshua Allen Date: Sun, 12 Mar 2017 19:04:27 -0400 Subject: save config after ootx data is completed --- src/survive_cal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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 ) -- cgit v1.2.3