mirror of https://github.com/arendst/Tasmota.git
Merge pull request #3007 from Drachenkaetzchen/development
Major performace Improvements for WS2812 pixels
This commit is contained in:
commit
63ee0a5870
|
@ -1118,6 +1118,7 @@ boolean LightCommand()
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
char *p;
|
char *p;
|
||||||
uint16_t idx = XdrvMailbox.index;
|
uint16_t idx = XdrvMailbox.index;
|
||||||
|
Ws2812ForceSuspend();
|
||||||
for (char *color = strtok_r(XdrvMailbox.data, " ", &p); color; color = strtok_r(NULL, " ", &p)) {
|
for (char *color = strtok_r(XdrvMailbox.data, " ", &p); color; color = strtok_r(NULL, " ", &p)) {
|
||||||
if (LightColorEntry(color, strlen(color))) {
|
if (LightColorEntry(color, strlen(color))) {
|
||||||
Ws2812SetColor(idx, light_entry_color[0], light_entry_color[1], light_entry_color[2], light_entry_color[3]);
|
Ws2812SetColor(idx, light_entry_color[0], light_entry_color[1], light_entry_color[2], light_entry_color[3]);
|
||||||
|
@ -1127,6 +1128,8 @@ boolean LightCommand()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ws2812ForceUpdate();
|
||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, Ws2812GetColor(XdrvMailbox.index, scolor));
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, Ws2812GetColor(XdrvMailbox.index, scolor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ uint8_t kRepeat[5] = {
|
||||||
1 }; // All
|
1 }; // All
|
||||||
|
|
||||||
uint8_t ws_show_next = 1;
|
uint8_t ws_show_next = 1;
|
||||||
|
bool ws_suspend_update = false;
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
void Ws2812StripShow()
|
void Ws2812StripShow()
|
||||||
|
@ -365,6 +365,19 @@ void Ws2812SetColor(uint16_t led, uint8_t red, uint8_t green, uint8_t blue, uint
|
||||||
strip->SetPixelColor(i, lcolor);
|
strip->SetPixelColor(i, lcolor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ws_suspend_update) {
|
||||||
|
strip->Show();
|
||||||
|
ws_show_next = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ws2812ForceSuspend () {
|
||||||
|
ws_suspend_update = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ws2812ForceUpdate () {
|
||||||
|
ws_suspend_update = false;
|
||||||
strip->Show();
|
strip->Show();
|
||||||
ws_show_next = 1;
|
ws_show_next = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue