Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion wled00/colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ void loadCustomPalettes() {
char fileName[32];
sprintf_P(fileName, PSTR("/palette%d.json"), index);
if (WLED_FS.exists(fileName)) {
emptyPaletteGap = 0; // reset gap counter if file exists
// add gray placeholders to preserve palette IDs for subsequent slots (is omitted in UI but shown in cpal.htm)
for (unsigned g = 0; g < emptyPaletteGap; g++)
customPalettes.push_back(CRGBPalette16(CRGB(128, 128, 128)));
emptyPaletteGap = 0; // reset gap counter if file exists
DEBUGFX_PRINTF_P(PSTR("Reading palette from %s\n"), fileName);
if (readObjectFromFile(fileName, nullptr, &pDoc)) {
JsonArray pal = pDoc[F("palette")];
Expand Down
2 changes: 2 additions & 0 deletions wled00/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,8 @@ function populatePalettes()
let li = lastinfo;
if (!isEmpty(li) && li.cpalcount) {
for (let j = 0; j<li.cpalcount; j++) {
const pd = palettesData[255-j];
if (pd && pd.length === 16 && pd.every(e => e[1] === 128 && e[2] === 128 && e[3] === 128)) continue; // skip all gray gap-placeholder entries
let div = d.createElement("div");
gId('pallist').appendChild(div);
div.outerHTML = generateListItemHtml(
Expand Down
2 changes: 1 addition & 1 deletion wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ void serializeInfo(JsonObject root)

root[F("fxcount")] = strip.getModeCount();
root[F("palcount")] = getPaletteCount();
root[F("cpalcount")] = customPalettes.size(); // number of custom palettes
root[F("cpalcount")] = customPalettes.size(); // number of custom palettes (includes gray placeholders)
root[F("cpalmax")] = WLED_MAX_CUSTOM_PALETTES; // maximum number of custom palettes

JsonArray ledmaps = root.createNestedArray(F("maps"));
Expand Down
Loading