From 76b8d191b0f59d6049f7500e29a91780a2e1676b Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Thu, 21 Aug 2025 17:14:37 +0200 Subject: [PATCH] core: gps: clear the RTC update request flag when sync is done Once the RTC has been synchronized with GPS time, set the gps_set_time flag back to false. This resets also the corresponding ON/OFF menu entry, providing both a feedback that the operation is done and allowing the user to just set it back to ON in case a new synchronization is needed. --- openrtx/src/core/gps.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/openrtx/src/core/gps.c b/openrtx/src/core/gps.c index 8221049c..aeda40ff 100644 --- a/openrtx/src/core/gps.c +++ b/openrtx/src/core/gps.c @@ -27,10 +27,7 @@ #define KNOTS2KMH(x) ((((int) x) * 1852) / 1000) -static bool gpsEnabled = false; -#ifdef CONFIG_RTC -static bool isRtcSyncronised = false; -#endif +static bool gpsEnabled = false; void gps_task(const struct gpsDevice *dev) { @@ -180,17 +177,15 @@ void gps_task(const struct gpsDevice *dev) #ifdef CONFIG_RTC if(state.gps_set_time) { - if((sId == MINMEA_SENTENCE_RMC) && - (gps_data.fix_quality > 0) && - (isRtcSyncronised == false)) + if((sId == MINMEA_SENTENCE_RMC) && (gps_data.fix_quality > 0)) { platform_setTime(gps_data.timestamp); - isRtcSyncronised = true; + + // Done, clear the flag + pthread_mutex_lock(&state_mutex); + state.gps_set_time = false; + pthread_mutex_unlock(&state_mutex); } } - else - { - isRtcSyncronised = false; - } #endif }