From 36252a51e045d1c0ec22c8c86239d1c422607571 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Tue, 19 Mar 2019 20:50:00 +0100 Subject: [PATCH] timesync.cpp: bugfix wrap around seqNo --- src/timesync.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timesync.cpp b/src/timesync.cpp index 878eef6c..e88d9a21 100644 --- a/src/timesync.cpp +++ b/src/timesync.cpp @@ -78,7 +78,7 @@ void process_timesync_req(void *taskparameter) { for (uint8_t i = 0; i < TIME_SYNC_SAMPLES; i++) { // wrap around seqNo 0 .. 254 - time_sync_seqNo = (time_sync_seqNo >= 255) ? 0 : time_sync_seqNo + 1; + time_sync_seqNo = (time_sync_seqNo < 255) ? time_sync_seqNo + 1 : 0; // send sync request to server payload.reset(); @@ -150,7 +150,7 @@ void process_timesync_req(void *taskparameter) { vTaskDelay(pdMS_TO_TICKS(wait_ms)); #if !defined(GPS_INT) && !defined(RTC_INT) - // sync timer pps to top of second + // sync esp32 hardware timer based pps to top of second timerRestart(ppsIRQ); // reset pps timer CLOCKIRQ(); // fire clock pps interrupt time_to_set++; // advance time 1 second