gps initial time sync added

This commit is contained in:
Verkehrsrot 2019-08-18 17:44:42 +02:00
parent ba08662323
commit c0692c3879

View File

@ -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