From e8dd82f24b36225d305a20a640c9b016f399b066 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Thu, 25 Apr 2019 14:50:47 +0200 Subject: [PATCH] Fixed Color2 should not reset Dimmer --- sonoff/xdrv_04_light.ino | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index 9eec4cb26..20c2d89a1 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -1683,12 +1683,15 @@ bool LightCommand(void) valid_entry = LightColorEntry(XdrvMailbox.data, XdrvMailbox.data_len); if (valid_entry) { if (XdrvMailbox.index <= 2) { // Color(1), 2 - // set RGB to light_entre_color + uint8_t old_bri = light_state.getBri(); + // change all channels to specified values light_controller.changeChannels(light_entry_color); - //light_controller.changeRGB(light_entry_color[0], light_entry_color[1], light_entry_color[2]); - // If Color(1) then reset brightness to maximum; if ((CMND_COLOR == command_code) && (1 == XdrvMailbox.index)) { + // If Color(1) then reset brightness to maximum; light_controller.changeBri(255); + } else { + // else set back initial brightness + light_controller.changeBri(old_bri); } Settings.light_scheme = 0;