"i" start index bugfix #3024

This commit is contained in:
Blaz Kristan 2023-01-14 16:01:46 +01:00
parent c71d378eab
commit 1f135f1fa5
2 changed files with 8 additions and 11 deletions

View File

@ -228,11 +228,11 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
for (size_t i = 0; i < iarr.size(); i++) { for (size_t i = 0; i < iarr.size(); i++) {
if(iarr[i].is<JsonInteger>()) { if(iarr[i].is<JsonInteger>()) {
if (!set) { if (!set) {
start = iarr[i]; start = abs(iarr[i].as<int>());
set = 1; set++;
} else { } else {
stop = iarr[i]; stop = abs(iarr[i].as<int>());
set = 2; set++;
} }
} else { //color } else { //color
uint8_t rgbw[] = {0,0,0,0}; uint8_t rgbw[] = {0,0,0,0};
@ -248,16 +248,13 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
} }
} }
if (set < 2) stop = start + 1; if (set < 2 || stop <= start) stop = start + 1;
uint32_t c = gamma32(RGBW32(rgbw[0], rgbw[1], rgbw[2], rgbw[3])); uint32_t c = gamma32(RGBW32(rgbw[0], rgbw[1], rgbw[2], rgbw[3]));
for (int i = start; i < stop; i++) { while (start < stop) seg.setPixelColor(start++, c);
seg.setPixelColor(i, c);
}
if (!set) start++;
set = 0; set = 0;
} }
} }
strip.trigger(); strip.trigger(); // force segment update
} }
// send UDP/WS if segment options changed (except selection; will also deselect current preset) // send UDP/WS if segment options changed (except selection; will also deselect current preset)
if (seg.differs(prev) & 0x7F) stateChanged = true; if (seg.differs(prev) & 0x7F) stateChanged = true;

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2301030 #define VERSION 2301140
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG