From dd5956020021aac5d7285043c8a40adf5967c924 Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Mon, 2 Apr 2018 15:00:26 +0200 Subject: [PATCH] Add hexadecimal RGB color entry on RGBCW leds 5.12.0i * Add hexadecimal RGB color entry on RGBCW leds (#2304) --- sonoff/_releasenotes.ino | 1 + sonoff/xdrv_01_light.ino | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index d5fed07f2..6f2e91046 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -7,6 +7,7 @@ * Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277) * Add support for SGP30 gas and air quality sensor (#2307) * Add multiple color entry support for command Led like Led2 120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue (#2303) + * Add hexadecimal RGB color entry on RGBCW leds (#2304) * Change webpage parameter communication * Change Timer parameter Device to more obvious Output * Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing diff --git a/sonoff/xdrv_01_light.ino b/sonoff/xdrv_01_light.ino index 2c9b04890..9230c1529 100644 --- a/sonoff/xdrv_01_light.ino +++ b/sonoff/xdrv_01_light.ino @@ -991,11 +991,10 @@ boolean LightColorEntry(char *buffer, uint8_t buffer_length) light_entry_color[i++] = atoi(str); } } -// entry_type = (light_subtype == i) ? 2 : 0; // Decimal entry_type = 2; // Decimal } - else if ((2 * light_subtype) == buffer_length) { // Hexadecimal entry - for (byte i = 0; i < light_subtype; i++) { + else if (((2 * light_subtype) == buffer_length) || (buffer_length > 3)) { // Hexadecimal entry + for (byte i = 0; i < buffer_length / 2; i++) { strlcpy(scolor, buffer + (i *2), 3); light_entry_color[i] = (uint8_t)strtol(scolor, &p, 16); }