From f2fd0750d52778ebbddfaf4681cfd52eab7b3f57 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 16 Jun 2021 13:37:33 +0200 Subject: [PATCH] Improve behavior of color2 for unlinked RGBW and RGBWW lights --- tasmota/xdrv_04_light.ino | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 27051e00e..5ecb4f2e8 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -2497,11 +2497,18 @@ void CmndSupportColor(void) else { #endif // USE_LIGHT_PALETTE uint32_t old_bri = light_state.getBri(); + uint32_t old_bri_rgb = light_state.getBriRGB(); // change all channels to specified values light_controller.changeChannels(Light.entry_color); if (2 == XdrvMailbox.index) { // If Color2, set back old brightness - LightSetBriScaled(old_bri); + if (light_controller.isCTRGBLinked()) { + // RGB and white are linked, adjust brightness of all channels + LightSetBriScaled(old_bri); + } else { + // RGB and white are unlinked, adjust brightness only of RGB channels + LightSetBri(Light.device, old_bri_rgb); + } } #ifdef USE_LIGHT_PALETTE }