Only reduce sleep for lights if necessary (#20146)

Co-authored-by: Shane Hird <shane@email.com>
This commit is contained in:
smhc 2023-12-26 21:41:55 +10:00 committed by GitHub
parent 3415453620
commit b7b83eaaaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1777,9 +1777,10 @@ void LightAnimate(void)
// make sure we update CT range in case SetOption82 was changed
Light.strip_timer_counter++;
// set sleep parameter: either settings,
// or set a maximum of PWM_MAX_SLEEP if light is on or Fade is running
if (Light.power || Light.fade_running) {
// Set a maximum sleep of PWM_MAX_SLEEP if Fade is running, or if light is on and
// a frequently updating light scheme is in use. This is to allow smooth transitions
// between light levels and colors.
if ((Settings->light_scheme > LS_POWER && Light.power) || Light.fade_running) {
if (TasmotaGlobal.sleep > PWM_MAX_SLEEP) {
sleep_previous = TasmotaGlobal.sleep; // save previous value of sleep
TasmotaGlobal.sleep = PWM_MAX_SLEEP; // set a maximum value (in milliseconds) to sleep to ensure that animations are smooth