From b6e62bf71583124994e91d0c1ebb0bb746d14b6c Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Mon, 27 Apr 2020 22:26:32 -0500 Subject: [PATCH] Only advance to next palette color when fade is down --- tasmota/xdrv_04_light.ino | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 9aaa9c9c0..971c0b2b2 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1702,17 +1702,19 @@ void LightCycleColor(int8_t direction) #ifdef USE_LIGHT_PALETTE if (Light.palette_count) { - if (0 == direction) { - Light.wheel = random(Light.palette_count); - } - else { - Light.wheel += direction; - if (Light.wheel >= Light.palette_count) { - Light.wheel = 0; - if (direction < 0) Light.wheel = Light.palette_count - 1; + if (!Light.fade_running) { + if (0 == direction) { + Light.wheel = random(Light.palette_count); } + else { + Light.wheel += direction; + if (Light.wheel >= Light.palette_count) { + Light.wheel = 0; + if (direction < 0) Light.wheel = Light.palette_count - 1; + } + } + LightSetPaletteEntry(); } - LightSetPaletteEntry(); return; } #endif // USE_LIGHT_PALETTE