From 4efef18d5d48291c7432b60ac4f4a676dbc98847 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Thu, 25 Apr 2019 14:59:39 +0200 Subject: [PATCH] Fixed wrong brightness for White command --- sonoff/xdrv_04_light.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index 20c2d89a1..91e511a29 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -1672,7 +1672,9 @@ bool LightCommand(void) ((CMND_WHITE == command_code) && (light_subtype == LST_RGBW) && (XdrvMailbox.index == 1))) { if (CMND_WHITE == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) { - snprintf_P(scolor, sizeof(scolor), PSTR("0,0,0,%d"), XdrvMailbox.payload * 255 / 100); + uint8_t whiteBri = changeUIntScale(XdrvMailbox.payload,0,100,0,255); + snprintf_P(scolor, sizeof(scolor), PSTR("0,0,0,%d"), whiteBri); + light_state.setBri(whiteBri); // save target Bri, will be confirmed below XdrvMailbox.data = scolor; XdrvMailbox.data_len = strlen(scolor); } else {