Skip to content

Commit

Permalink
Fix for #3926
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Apr 23, 2024
1 parent 6f3d7e7 commit 127ea7e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1664,12 +1664,18 @@ bool WS2812FX::deserializeMap(uint8_t n) {
return false; // if file does not load properly then exit
}

JsonObject root = pDoc->as<JsonObject>();
// if we are loading default ledmap (at boot) set matrix width and height from the ledmap (compatible with WLED MM ledmaps)
if (isMatrix && n == 0 && (!root[F("width")].isNull() || !root[F("height")].isNull())) {
Segment::maxWidth = min(max(root[F("width")].as<int>(), 1), 128);
Segment::maxHeight = min(max(root[F("height")].as<int>(), 1), 128);
}

if (customMappingTable) delete[] customMappingTable;
customMappingTable = new uint16_t[getLengthTotal()];

if (customMappingTable) {
DEBUG_PRINT(F("Reading LED map from ")); DEBUG_PRINTLN(fileName);
JsonObject root = pDoc->as<JsonObject>();
JsonArray map = root[F("map")];
if (!map.isNull() && map.size()) { // not an empty map
customMappingSize = min((unsigned)map.size(), (unsigned)getLengthTotal());
Expand Down

0 comments on commit 127ea7e

Please sign in to comment.