From 1ae444b342a84f80a5c583b03a1468f715b64334 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 2 Mar 2019 22:56:00 +0100 Subject: [PATCH] gpsread fixes --- src/gpsread.cpp | 15 +++++++++------ src/if482.cpp | 4 +--- src/timekeeper.cpp | 1 - 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gpsread.cpp b/src/gpsread.cpp index afa53888..ec900251 100644 --- a/src/gpsread.cpp +++ b/src/gpsread.cpp @@ -92,14 +92,17 @@ time_t get_gpstime(void) { time_t t = 0; - if ((gps.time.age() < gpsDelay_ms) && (gps.time.isValid()) && (gps.date.isValid())) { + if ((gps.time.age() < gpsDelay_ms) && (gps.time.isValid()) && + (gps.date.isValid())) { - ESP_LOGD(TAG, "GPS time age: %dms, second: %d, is valid: %s", gps.time.age(), gps.time.second(), - gps.time.isValid() ? "yes" : "no"); + ESP_LOGD(TAG, "GPS time age: %dms, is valid: %s, second: %d,", + gps.time.age(), + (gps.time.isValid() && gps.date.isValid()) ? "yes" : "no", + gps.time.second()); - t = tmConvert(gps.date.year(), gps.date.month(), gps.date.day(), - gps.time.hour(), gps.time.minute(), gps.time.second()); - } + t = tmConvert(gps.date.year(), gps.date.month(), gps.date.day(), + gps.time.hour(), gps.time.minute(), gps.time.second()); + } return timeIsValid(t); } // get_gpstime() diff --git a/src/if482.cpp b/src/if482.cpp index a532fdaa..2e4512a2 100644 --- a/src/if482.cpp +++ b/src/if482.cpp @@ -92,9 +92,7 @@ void IF482_Pulse(time_t t) { static const TickType_t txDelay = pdMS_TO_TICKS(IF482_PULSE_LENGTH - tx_Ticks(IF482_FRAME_SIZE, HAS_IF482)); - //TickType_t startTime = xTaskGetTickCount(); - //vTaskDelayUntil(&startTime, txDelay); // wait until moment to fire - vTaskDelay(txDelay); // wait until moment to fire + vTaskDelay(txDelay); // wait until moment to fire IF482.print(IF482_Frame(t + 1)); // note: if482 telegram for *next* second } diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index fe5b3920..94ebbf00 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -101,7 +101,6 @@ void timepulse_start(void) { void IRAM_ATTR CLOCKIRQ(void) { BaseType_t xHigherPriorityTaskWoken; - time_t t = SyncToPPS(); // calibrates UTC systime, see Time.h xHigherPriorityTaskWoken = pdFALSE;