Port to lora_isp4520 board

This commit is contained in:
Vadim Furman
2021-03-14 19:00:20 -07:00
parent ea40bd991c
commit 98d878cdfe
19 changed files with 604 additions and 128 deletions
+8 -7
View File
@@ -39,22 +39,23 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv)
currentQuality = q;
shouldSet = true;
DEBUG_MSG("Upgrading time to RTC %ld secs (quality %d)\n", tv->tv_sec, q);
} else if(q == RTCQualityGPS && (now - lastSetMsec) > (12 * 60 * 60 * 1000L)) {
// Every 12 hrs we will slam in a new GPS time, to correct for local RTC clock drift
} else if(q > RTCQualityNone && q == currentQuality && (now - lastSetMsec) > (12 * 60 * 60 * 1000L)) {
// Every 12 hrs we will slam in a new time, to correct for local RTC clock drift
shouldSet = true;
DEBUG_MSG("Reapplying GPS time to correct clock drift %ld secs\n", tv->tv_sec);
DEBUG_MSG("Reapplying external time to correct clock drift %ld secs\n", tv->tv_sec);
}
else
shouldSet = false;
if (shouldSet) {
lastSetMsec = now;
lastSetMsec = now;
#ifndef NO_ESP32
settimeofday(tv, NULL);
#else
DEBUG_MSG("ERROR TIME SETTING NOT IMPLEMENTED!\n");
#endif
readFromRTC();
#else
timeStartMsec = now;
zeroOffsetSecs = tv->tv_sec;
#endif
return true;
} else {
return false;