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.
This commit is contained in:
Silvano Seva 2025-08-21 17:14:37 +02:00
parent 2f0b7f8df7
commit 76b8d191b0
1 changed files with 7 additions and 12 deletions

View File

@ -28,9 +28,6 @@
#define KNOTS2KMH(x) ((((int) x) * 1852) / 1000)
static bool gpsEnabled = false;
#ifdef CONFIG_RTC
static bool isRtcSyncronised = false;
#endif
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
}