From b7b83eaaaad487aa66a8b1eeadb645da49aac7fd Mon Sep 17 00:00:00 2001 From: smhc Date: Tue, 26 Dec 2023 21:41:55 +1000 Subject: [PATCH] Only reduce sleep for lights if necessary (#20146) Co-authored-by: Shane Hird --- tasmota/tasmota_xdrv_driver/xdrv_04_light.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino index 127e036c3..e52f31783 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino @@ -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