Fixed bug in gps task which made it setting time and date even whithout GPS fix.

This commit is contained in:
Silvano Seva 2021-03-24 12:28:45 +01:00
parent f2f7f6dd51
commit 90122b0c7a
1 changed files with 3 additions and 2 deletions

View File

@ -66,8 +66,9 @@ void gps_taskFunc(char *line, __attribute__((unused)) int len, state_t *state)
state->gps_data.timestamp.year = frame.date.year;
}
// Synchronize RTC with GPS UTC clock
if((state->settings.gps_set_time) && (!isRtcSyncronised))
// Synchronize RTC with GPS UTC clock, only when fix is done
if((state->settings.gps_set_time) &&
(state->gps_data.fix_quality > 0) && (!isRtcSyncronised))
{
rtc_setTime(state->gps_data.timestamp);
isRtcSyncronised = true;