From 1efca24ff28095764272fa1d6d8722255f328dd1 Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Thu, 11 May 2023 18:21:55 +0200 Subject: [PATCH] timing counter call added to the pwm test, updated the tc_update functions to check if the tc is anabled. --- firmware/firmware.ino | 10 +++++----- firmware/timing_control.ino | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) 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