From ba51d73d4ecd8e1bed74e407496fdc4b672a6d97 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 14 Apr 2019 14:35:48 +0200 Subject: [PATCH] fix time sync pps start bug --- src/timekeeper.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index 7ea4c7a1..717c0463 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -20,9 +20,7 @@ HardwareSerial IF482(2); // use UART #2 (#1 may be in use for serial GPS) Ticker timesyncer; -void timeSync() { - xTaskNotifyFromISR(irqHandlerTask, TIMESYNC_IRQ, eSetBits, NULL); -} +void timeSync() { xTaskNotify(irqHandlerTask, TIMESYNC_IRQ, eSetBits); } time_t timeProvider(void) { @@ -116,6 +114,7 @@ void timepulse_start(void) { timerAttachInterrupt(ppsIRQ, &CLOCKIRQ, true); timerAlarmEnable(ppsIRQ); #endif + now(); // refresh sysTime to pps // start cyclic time sync timeSync(); // init systime by RTC or GPS or LORA @@ -213,7 +212,7 @@ void clock_init(void) { void clock_loop(void *taskparameter) { // ClockTask // caveat: don't use now() in this task, it will cause a race condition - // due to concurrent access to i2c bus for setting rtc via SyncProvider! + // due to concurrent access to i2c bus for setting rtc! #define nextmin(t) (t + DCF77_FRAME_SIZE + 1) // next minute