new time_init()

This commit is contained in:
cyberman54 2022-03-05 17:33:50 +01:00
parent b393dae769
commit 8394f3be70
2 changed files with 11 additions and 8 deletions

View File

@ -471,15 +471,15 @@ void setup() {
button_init(HAS_BUTTON); button_init(HAS_BUTTON);
#endif // HAS_BUTTON #endif // HAS_BUTTON
// cyclic function interrupts
cyclicTimer.attach(HOMECYCLE, setCyclicIRQ);
// only if we have a timesource we do timesync // only if we have a timesource we do timesync
#if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC)) #if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC))
time_init(); time_init();
strcat_P(features, " TIME"); strcat_P(features, " TIME");
#endif // timesync #endif // timesync
// cyclic function interrupts
cyclicTimer.attach(HOMECYCLE, setCyclicIRQ);
// show compiled features // show compiled features
ESP_LOGI(TAG, "Features:%s", features); ESP_LOGI(TAG, "Features:%s", features);

View File

@ -381,13 +381,16 @@ time_t mkgmtime(const struct tm *ptm) {
} }
void time_init(void) { 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) #if (defined HAS_IF482 || defined HAS_DCF77)
ESP_LOGI(TAG, "Starting clock controller..."); ESP_LOGI(TAG, "Starting clock controller...");
clock_init(); clock_init();
#endif #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
} }