From 50217485ecb2a6f927789bff814632b7a30b312b Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 10 Apr 2020 22:55:21 +0200 Subject: [PATCH] Limit power after reinit --- tasmota/xdrv_04_light.ino | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 21dd0f65f..240a09417 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -950,17 +950,21 @@ public: // only if non-multi channel // We apply dimmer in priority to RGB uint8_t bri = _state->DimmerToBri(Settings.light_dimmer); + + // The default values are #FFFFFFFFFF, in this case we avoid setting all channels + // at the same time, see #6534 and #8120 + if ((DEFAULT_LIGHT_COMPONENT == Settings.light_color[0]) && + (DEFAULT_LIGHT_COMPONENT == Settings.light_color[1]) && + (DEFAULT_LIGHT_COMPONENT == Settings.light_color[2]) && + (DEFAULT_LIGHT_COMPONENT == Settings.light_color[3]) && + (DEFAULT_LIGHT_COMPONENT == Settings.light_color[4]) && + (DEFAULT_LIGHT_DIMMER == Settings.light_dimmer) ) { + _state->setBriCT(bri); + _state->setBriRGB(bri); + _state->setColorMode(LCM_RGB); + } + if (Settings.light_color[0] + Settings.light_color[1] + Settings.light_color[2] > 0) { - // The default values are #FFFFFFFFFF, in this case we avoid setting all channels - // at the same time, see #6534 - if ( (DEFAULT_LIGHT_COMPONENT == Settings.light_color[0]) && - (DEFAULT_LIGHT_COMPONENT == Settings.light_color[1]) && - (DEFAULT_LIGHT_COMPONENT == Settings.light_color[2]) && - (DEFAULT_LIGHT_COMPONENT == Settings.light_color[3]) && - (DEFAULT_LIGHT_COMPONENT == Settings.light_color[4]) && - (DEFAULT_LIGHT_DIMMER == Settings.light_dimmer) ) { - _state->setColorMode(LCM_RGB); - } _state->setBriRGB(bri); } else { _state->setBriCT(bri);