trigger timesync only if a timesource is present

This commit is contained in:
Klaus K Wilting 2020-11-02 21:32:45 +01:00
parent 70a37322b5
commit 8b496d9df4

View File

@ -344,7 +344,7 @@ void setup() {
strcat_P(features, " LORA"); strcat_P(features, " LORA");
// kick off join, except we come from sleep // kick off join, except we come from sleep
_ASSERT(lora_stack_init(RTC_runmode == RUNMODE_WAKEUP ? false : true) == _ASSERT(lora_stack_init(RTC_runmode == RUNMODE_WAKEUP ? false : true) ==
ESP_OK); ESP_OK);
#endif #endif
// initialize SPI // initialize SPI
@ -490,12 +490,9 @@ void setup() {
sendTimer.attach(cfg.sendcycle * 2, setSendIRQ); sendTimer.attach(cfg.sendcycle * 2, setSendIRQ);
cyclicTimer.attach(HOMECYCLE, setCyclicIRQ); cyclicTimer.attach(HOMECYCLE, setCyclicIRQ);
#if (TIME_SYNC_INTERVAL) // only if we have a timesource we do timesync
#if ((TIME_SYNC_LORAWAN) || (TIME_SYNC_LORASERVER) || (HAS_GPS) || \
#if (!(TIME_SYNC_LORAWAN) && !(TIME_SYNC_LORASERVER) && !defined HAS_GPS && \ defined HAS_RTC)
!defined HAS_RTC)
#warning you did not specify a time source, time will not be synched
#endif
#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...");
@ -508,9 +505,11 @@ void setup() {
ESP_LOGI(TAG, "Starting Timekeeper..."); ESP_LOGI(TAG, "Starting Timekeeper...");
_ASSERT(timepulse_init()); // setup pps timepulse _ASSERT(timepulse_init()); // setup pps timepulse
timepulse_start(); // starts pps and cyclic time sync timepulse_start(); // starts pps and cyclic time sync
#endif // TIME_SYNC_INTERVAL strcat_P(features, "TIME");
#endif // timesync
// show compiled features // show compiled features
ESP_LOGI(TAG, "Features:%s", features); ESP_LOGI(TAG, "Features:%s", features);