Skip to content

Commit c224a18

Browse files
committed
reload custom palettes after platette file upload
fixes a very old bug! Now custom palettes should be up-to-date after edit, without a reboot.
1 parent afd4108 commit c224a18

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

wled00/wled_server.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,16 @@ void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t
122122
} else {
123123
if (filename.equals("/presets.json") || filename.equals("presets.json")) { // WLEDMM
124124
request->send(200, "text/plain", F("Presets File Uploaded!"));
125-
} else
126-
request->send(200, "text/plain", F("File Uploaded!"));
125+
} else {
126+
String lowerFilename = filename; // WLEDMM: use case-insensitive matching
127+
lowerFilename.toLowerCase();
128+
if (lowerFilename.indexOf(F("palette")) >= 0 && lowerFilename.endsWith(F(".json"))) {
129+
DEBUG_PRINTLN(F("Re-loading custom palettes."));
130+
strip.loadCustomPalettes();
131+
request->send(200, "text/plain", F("Custom Palette File Uploaded!"));
132+
} else
133+
request->send(200, "text/plain", F("File Uploaded!"));
134+
}
127135
}
128136
cacheInvalidate++;
129137
updateFSInfo(); // refresh memory usage info

0 commit comments

Comments
 (0)