From 8394f3be709b02f0cc9e4012b15e96b2ccff33c5 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 5 Mar 2022 17:33:50 +0100 Subject: [PATCH] new time_init() --- src/main.cpp | 6 +++--- src/timekeeper.cpp | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b9176b0c..e84c376a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -471,15 +471,15 @@ void setup() { button_init(HAS_BUTTON); #endif // HAS_BUTTON - // cyclic function interrupts - cyclicTimer.attach(HOMECYCLE, setCyclicIRQ); - // only if we have a timesource we do timesync #if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC)) time_init(); strcat_P(features, " TIME"); #endif // timesync + // cyclic function interrupts + cyclicTimer.attach(HOMECYCLE, setCyclicIRQ); + // show compiled features ESP_LOGI(TAG, "Features:%s", features); diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index 3545d915..896f49ec 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -381,13 +381,16 @@ time_t mkgmtime(const struct tm *ptm) { } void time_init(void) { -#if (HAS_LORA_TIME) - timesync_init(); // create loraserver time sync task -#endif - ESP_LOGI(TAG, "Starting time pulse..."); - timepulse_init(); // starts pps and cyclic time sync + #if (defined HAS_IF482 || defined HAS_DCF77) ESP_LOGI(TAG, "Starting clock controller..."); clock_init(); #endif + +#if (HAS_LORA_TIME) + timesync_init(); // create loraserver time sync task +#endif + + ESP_LOGI(TAG, "Starting time pulse..."); + timepulse_init(); // starts pps and cyclic time sync } \ No newline at end of file