timing counter call added to the pwm test, updated the tc_update functions to check if the tc is anabled.

This commit is contained in:
Kai Lauterbach 2023-05-11 18:21:55 +02:00
parent 0773d7717f
commit 1efca24ff2
2 changed files with 15 additions and 5 deletions

View file

@ -358,11 +358,8 @@ void loop()
lightEngine(); 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(); ESP.wdtFeed();
@ -1136,6 +1133,9 @@ void test_pwm_main()
transitiontime[i] = 0; transitiontime[i] = 0;
process_lightdata(i, transitiontime[i]); process_lightdata(i, transitiontime[i]);
} }
tc_update_main(); // load the tc if required
test_pwm_state = TEST_PWM_STATE_INIT; test_pwm_state = TEST_PWM_STATE_INIT;
} }
break; break;

View file

@ -130,6 +130,11 @@ void tc_update_loop()
{ {
static uint8_t last_min_check = 255; 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 if ((timeClient.getMinutes() % 10) != 0 || last_min_check == timeClient.getMinutes()) // && tc_testOngoing == false
{ {
last_min_check = timeClient.getMinutes(); last_min_check = timeClient.getMinutes();
@ -144,6 +149,11 @@ void tc_update_main()
static uint8_t current_target_data_block = 255; static uint8_t current_target_data_block = 255;
uint8_t target_data_block = 255; uint8_t target_data_block = 255;
if (tc_enabled == TIMING_CONTROL_DISABLED)
{
return;
}
tc_updateTime(); tc_updateTime();
// search for the current active time slot // search for the current active time slot