Merge pull request #8121 from s-hadinger/light_init

Limit power after reinit
This commit is contained in:
Theo Arends 2020-04-11 08:28:22 +02:00 committed by GitHub
commit 849916a5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);