mirror of https://github.com/arendst/Tasmota.git
Add multiple colors to Led command
5.12.0i * 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)
This commit is contained in:
parent
96212834cf
commit
ce98c6cacc
|
@ -4,9 +4,10 @@
|
|||
* Add optional Timer configuration webpage to be enabled in user_config.h with define USE_TIMERS_WEB
|
||||
* 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)
|
||||
* Change webpage parameter communication
|
||||
* Change Timer parameter Device to more obvious Output
|
||||
* Change max number of commands in Backlog from 15 to 30
|
||||
* Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing
|
||||
* Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
|
||||
* Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
|
||||
*
|
||||
|
|
|
@ -1114,8 +1114,16 @@ boolean LightCommand()
|
|||
#ifdef USE_WS2812 // ***********************************************************************
|
||||
else if ((CMND_LED == command_code) && (LT_WS2812 == light_type) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= Settings.light_pixels)) {
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
if (LightColorEntry(XdrvMailbox.data, XdrvMailbox.data_len)) {
|
||||
Ws2812SetColor(XdrvMailbox.index, light_entry_color[0], light_entry_color[1], light_entry_color[2], light_entry_color[3]);
|
||||
char *p;
|
||||
uint16_t idx = XdrvMailbox.index;
|
||||
for (char *color = strtok_r(XdrvMailbox.data, ".", &p); color; color = strtok_r(NULL, ".", &p)) {
|
||||
if (LightColorEntry(color, strlen(color))) {
|
||||
Ws2812SetColor(idx, light_entry_color[0], light_entry_color[1], light_entry_color[2], light_entry_color[3]);
|
||||
idx++;
|
||||
if (idx >= Settings.light_pixels) break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, Ws2812GetColor(XdrvMailbox.index, scolor));
|
||||
|
|
Loading…
Reference in New Issue