diff --git a/firmware/firmware.ino b/firmware/firmware.ino index c9fe43a..885bab6 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -358,11 +358,8 @@ void loop() lightEngine(); - if (tc_enabled == TIMING_CONTROL_ENABLED) - { - //Serial.println("tc_enabled = " + (String)tc_enabled); - tc_update_loop(); - } + //Serial.println("tc_enabled = " + (String)tc_enabled); + tc_update_loop(); ESP.wdtFeed(); @@ -1136,6 +1133,9 @@ void test_pwm_main() transitiontime[i] = 0; process_lightdata(i, transitiontime[i]); } + + tc_update_main(); // load the tc if required + test_pwm_state = TEST_PWM_STATE_INIT; } break; diff --git a/firmware/timing_control.ino b/firmware/timing_control.ino index 17fea0a..83f9c07 100644 --- a/firmware/timing_control.ino +++ b/firmware/timing_control.ino @@ -130,6 +130,11 @@ void tc_update_loop() { static uint8_t last_min_check = 255; + if (tc_enabled == TIMING_CONTROL_DISABLED) + { + return; + } + if ((timeClient.getMinutes() % 10) != 0 || last_min_check == timeClient.getMinutes()) // && tc_testOngoing == false { last_min_check = timeClient.getMinutes(); @@ -144,6 +149,11 @@ void tc_update_main() static uint8_t current_target_data_block = 255; uint8_t target_data_block = 255; + if (tc_enabled == TIMING_CONTROL_DISABLED) + { + return; + } + tc_updateTime(); // search for the current active time slot