diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index f2765bf7..ff332151 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -33,9 +33,6 @@ void setTimeSyncIRQ() { xTaskNotify(irqHandlerTask, TIMESYNC_IRQ, eSetBits); } void calibrateTime(void) { - time_t t = 0; - uint16_t t_msec = 0; - // kick off asynchronous lora timesync if we have #if (HAS_LORA_TIME) timesync_request(); @@ -43,6 +40,10 @@ void calibrateTime(void) { return; #endif +#if ((HAS_GPS) || (HAS_RTC)) + time_t t = 0; + uint16_t t_msec = 0; + // get GPS time, if we have #if (HAS_GPS) t = get_gpstime(&t_msec); @@ -57,6 +58,8 @@ void calibrateTime(void) { return; #endif +#endif + } // calibrateTime() // set system time (UTC), calibrate RTC and RTC_INT pps @@ -250,9 +253,7 @@ void clock_init(void) { void clock_loop(void *taskparameter) { // ClockTask - uint64_t ClockPulse = 0; uint32_t current_time = 0, previous_time = 0; - int8_t ClockMinute = -1; time_t tt; struct tm t = {0}; #ifdef HAS_TWO_LED @@ -292,6 +293,9 @@ void clock_loop(void *taskparameter) { // ClockTask #elif defined HAS_DCF77 + uint64_t ClockPulse = 0; + int8_t ClockMinute = -1; + // load new frame if second 59 is reached if (t.tm_sec == 0) { ClockMinute = t.tm_min;