Fix ledmap code

Index.js: fix ledmap bug
json.cpp: remove old ledmap checks
presets.cpp: remove loadledmap call
This commit is contained in:
Ewoud
2022-11-19 14:15:29 +01:00
parent 8b25dc275e
commit 7946c745d4
6 changed files with 59 additions and 69 deletions

View File

@@ -423,11 +423,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
usermods.readFromJsonState(root);
//WLEDMM: if no ledmap loadLedmap=0 (which erases customMappingTable in deserializeMap if exists)
if (root[F("ledmap")].isNull())
loadLedmap = 0;
else
loadLedmap = root[F("ledmap")] | loadLedmap;
loadLedmap = root[F("ledmap")] | loadLedmap;
byte ps = root[F("psave")];
if (ps > 0 && ps < 251) savePreset(ps, nullptr, root);
@@ -550,11 +546,6 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
root["bri"] = briLast;
root[F("transition")] = transitionDelay/100; //in 100ms
}
//WLEDMM only add ledmap if defined, otherwise remove (then ledmap is 0 is assumed in deserializeState)
if (loadLedmap>0)
root[F("ledmap")] = loadLedmap;
else
root.remove(F("ledmap"));
if (!forPreset) {
if (errorFlag) {root[F("error")] = errorFlag; errorFlag = ERR_NONE;} //prevent error message to persist on screen