From c0692c38798ccaf72177ed3292b713def075147b Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 18 Aug 2019 17:44:42 +0200 Subject: [PATCH] gps initial time sync added --- src/gpsread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gpsread.cpp b/src/gpsread.cpp index 262daf0a..bcefd2a2 100644 --- a/src/gpsread.cpp +++ b/src/gpsread.cpp @@ -90,13 +90,12 @@ time_t fetch_gpsTime(uint16_t *msec) { // poll NMEA $GPZDA sentence #ifdef GPS_SERIAL GPS_Serial.print(ZDA_Request); + // wait for gps NMEA answer + vTaskDelay(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL)); #elif defined GPS_I2C Wire.print(ZDA_Request); #endif - // wait for gps NMEA answer - //vTaskDelay(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL)); - // did we get a current time? if (gpstime.isUpdated() && gpstime.isValid()) { @@ -104,7 +103,8 @@ time_t fetch_gpsTime(uint16_t *msec) { String rawtime = gpstime.value(); uint32_t time_bcd = rawtime.toFloat() * 100; - uint32_t delay_ms = gpstime.age() + nmea_txDelay_ms + NMEA_COMPENSATION_FACTOR; + uint32_t delay_ms = + gpstime.age() + nmea_txDelay_ms + NMEA_COMPENSATION_FACTOR; uint8_t year = CalendarYrToTm(gps.date.year()); // year offset from 1970 in microTime.h