Fix GPS time sync rules

This commit is contained in:
Theo Arends 2022-02-26 14:39:39 +01:00
parent bea7e67363
commit 7d8b4483d2
3 changed files with 7 additions and 4 deletions

View File

@ -748,7 +748,7 @@ void WifiPollNtp() {
Rtc.utc_time = ntp_time;
ntp_sync_minute = 60; // Sync so block further requests
RtcSync();
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("NTP: Synched"));
AddLog(LOG_LEVEL_DEBUG, PSTR("NTP: Synched"));
} else {
ntp_sync_minute++; // Try again in next minute
}

View File

@ -171,7 +171,8 @@ void DS3231EverySecond(void) {
if (ds3231_time > START_VALID_TIME) {
Rtc.utc_time = ds3231_time;
RtcSync();
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DS3: Synched"));
AddLog(LOG_LEVEL_DEBUG, PSTR("DS3: Synched"));
// Rtc.user_time_entry = true; // Stop NTP sync and DS3231 time write
ds3231ReadStatus = true; // if time in DS3231 is valid, do not update again
}
}

View File

@ -677,9 +677,11 @@ void UBXHandleTIME()
gpsTime.minute = UBX.Message.navTime.min;
gpsTime.second = UBX.Message.navTime.sec;
UBX.rec_buffer.values.time = MakeTime(gpsTime);
if (UBX.mode.forceUTCupdate || Rtc.user_time_entry == false){
AddLog(LOG_LEVEL_INFO, PSTR("UBX: UTC-Time is valid, set system time"));
if (UBX.mode.forceUTCupdate || Rtc.user_time_entry == false) {
// AddLog(LOG_LEVEL_INFO, PSTR("UBX: UTC-Time is valid, set system time"));
Rtc.utc_time = UBX.rec_buffer.values.time;
RtcSync();
AddLog(LOG_LEVEL_DEBUG, PSTR("UBX: Synched"));
}
Rtc.user_time_entry = true;
}