GPS time fixes
This commit is contained in:
parent
195661a520
commit
e5ce70be75
@ -52,6 +52,7 @@ void irqHandler(void *pvParameters) {
|
||||
#if (TIME_SYNC_INTERVAL)
|
||||
// is time to be synced?
|
||||
if (InterruptStatus & TIMESYNC_IRQ) {
|
||||
now(); // ensure sysTime is recent
|
||||
time_t t = timeProvider();
|
||||
if (timeIsValid(t))
|
||||
setTime(t);
|
||||
|
@ -51,7 +51,7 @@ So don't do it if you do not own a digital oscilloscope.
|
||||
-------------------------------------------------------------------------------
|
||||
0 displayIRQ -> display refresh -> 40ms (DISPLAYREFRESH_MS)
|
||||
1 ppsIRQ -> pps clock irq -> 1sec
|
||||
2 gpsIRQ -> gps store data -> 500ms
|
||||
2 gpsIRQ -> gps store data -> 300ms
|
||||
3 unused
|
||||
|
||||
|
||||
@ -414,7 +414,7 @@ void setup() {
|
||||
#if (HAS_GPS)
|
||||
gpsIRQ = timerBegin(2, 80, true);
|
||||
timerAttachInterrupt(gpsIRQ, &GpsIRQ, true);
|
||||
timerAlarmWrite(gpsIRQ, 500 * 1000, true);
|
||||
timerAlarmWrite(gpsIRQ, 300 * 1000, true);
|
||||
timerAlarmEnable(gpsIRQ);
|
||||
#endif
|
||||
|
||||
|
@ -39,6 +39,7 @@ time_t timeProvider(void) {
|
||||
#endif
|
||||
timeSource = _gps;
|
||||
timesyncer.attach(TIME_SYNC_INTERVAL * 60, timeSync); // regular repeat
|
||||
ESP_LOGD(TAG, "GPS time = %d", t);
|
||||
return t;
|
||||
}
|
||||
#endif
|
||||
@ -49,6 +50,7 @@ time_t timeProvider(void) {
|
||||
if (t) {
|
||||
timeSource = _rtc;
|
||||
timesyncer.attach(TIME_SYNC_INTERVAL_RETRY * 60, timeSync); // short retry
|
||||
ESP_LOGD(TAG, "RTC time = %d", t);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -127,7 +129,6 @@ void timepulse_start(void) {
|
||||
#endif
|
||||
|
||||
// start cyclic time sync
|
||||
now(); // ensure sysTime is ßrecent
|
||||
timeSync(); // init systime by RTC or GPS or LORA
|
||||
timesyncer.attach(TIME_SYNC_INTERVAL * 60, timeSync);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user