Skip to content

Commit 617ea8f

Browse files
authored
bugfix: ledmap.json discarded too early
* added missing check for "ledmap.json" file => always applied * added missing check for ledmap1...10 * setupMatrix test for "unity" ledmap was too early - removed (need to find a better place for this)
1 parent 4521ba8 commit 617ea8f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

wled00/FX_2Dfcn.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ void WS2812FX::setUpMatrix() {
4848

4949
// WLEDMM check if mapping table is necessary (avoiding heap fragmentation)
5050
//#if defined(WLED_ENABLE_HUB75MATRIX)
51-
bool needLedMap = (loadedLedmap >0); // ledmap loaded
52-
needLedMap |= WLED_FS.exists(F("/2d-gaps.json")); // gapFile found
51+
bool needLedMap = (loadedLedmap >0); // ledmap loaded
5352
needLedMap |= panel.size() > 1; // 2D config: more than one panel
5453
if (panel.size() == 1) {
5554
Panel &p = panel[0];
@@ -58,6 +57,11 @@ void WS2812FX::setUpMatrix() {
5857
needLedMap |= p.bottomStart | p.rightStart; // panel not top left, or not left->light
5958
needLedMap |= (p.xOffset > 0) || (p.yOffset > 0); // panel does not start at (0,0)
6059
}
60+
needLedMap |= (ledMaps >1) && (loadedLedmap >0); // ledmap1...10 loaded
61+
if (!needLedMap) { // only perform file cheking if we must (may cause flicker)
62+
needLedMap |= WLED_FS.exists(F("/2d-gaps.json")); // gapFile found
63+
needLedMap |= WLED_FS.exists(F("/ledmap.json")); // global ledmap found
64+
}
6165
//#else
6266
// bool needLedMap = true; // un-comment to always use ledMaps on non-HUB75 builds
6367
//#endif
@@ -172,6 +176,7 @@ void WS2812FX::setUpMatrix() {
172176
}
173177
}
174178

179+
#if 0 // WLEDMM this test is too early - ledmap will be loaded later
175180
#ifdef WLED_ENABLE_HUB75MATRIX
176181
// softhack007 hack: delete mapping table in case it only contains "identity"
177182
if (customMappingTable != nullptr && customMappingTableSize > 0) {
@@ -188,6 +193,7 @@ void WS2812FX::setUpMatrix() {
188193
}
189194
}
190195
#endif
196+
#endif
191197

192198
#else
193199
isMatrix = false; // no matter what config says

0 commit comments

Comments
 (0)