Fix getPaletteCount bug fix bug

This commit is contained in:
Ewoud
2023-02-04 12:52:34 +01:00
parent becf87ea0b
commit 119c347ffa

View File

@@ -959,7 +959,7 @@ void setPaletteColors(JsonArray json, byte* tcp)
void serializePalettes(JsonObject root, AsyncWebServerRequest* request)
{
byte tcp[strip.getPaletteCount()]; //WLEDMM use real count instead of fixed number 72
byte tcp[13 + GRADIENT_PALETTE_COUNT]; //WLEDMM use real count instead of fixed number 72 (strip.getPaletteCount() not working on 8266)
#ifdef ESP8266
int itemPerPage = 5;
#else
@@ -1054,7 +1054,7 @@ void serializePalettes(JsonObject root, AsyncWebServerRequest* request)
if (i>=palettesCount) {
setPaletteColors(curPalette, strip.customPalettes[i - palettesCount]);
} else {
memcpy_P(tcp, (byte*)pgm_read_dword(&(gGradientPalettes[i - 13])), strip.getPaletteCount()); //WLEDMM use real count instead of fixed number 72
memcpy_P(tcp, (byte*)pgm_read_dword(&(gGradientPalettes[i - 13])), 13 + GRADIENT_PALETTE_COUNT); //WLEDMM use real count instead of fixed number 72 (strip.getPaletteCount() not working on 8266)
setPaletteColors(curPalette, tcp);
}
}