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