From 617ea8fa045ff6d43582e595b4632b56f7778f89 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 30 Dec 2025 15:46:47 +0100 Subject: [PATCH] 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) --- wled00/FX_2Dfcn.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index a5507f23..1e7505cb 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -48,8 +48,7 @@ void WS2812FX::setUpMatrix() { // WLEDMM check if mapping table is necessary (avoiding heap fragmentation) //#if defined(WLED_ENABLE_HUB75MATRIX) - bool needLedMap = (loadedLedmap >0); // ledmap loaded - needLedMap |= WLED_FS.exists(F("/2d-gaps.json")); // gapFile found + bool needLedMap = (loadedLedmap >0); // ledmap loaded needLedMap |= panel.size() > 1; // 2D config: more than one panel if (panel.size() == 1) { Panel &p = panel[0]; @@ -58,6 +57,11 @@ void WS2812FX::setUpMatrix() { needLedMap |= p.bottomStart | p.rightStart; // panel not top left, or not left->light needLedMap |= (p.xOffset > 0) || (p.yOffset > 0); // panel does not start at (0,0) } + needLedMap |= (ledMaps >1) && (loadedLedmap >0); // ledmap1...10 loaded + if (!needLedMap) { // only perform file cheking if we must (may cause flicker) + needLedMap |= WLED_FS.exists(F("/2d-gaps.json")); // gapFile found + needLedMap |= WLED_FS.exists(F("/ledmap.json")); // global ledmap found + } //#else // bool needLedMap = true; // un-comment to always use ledMaps on non-HUB75 builds //#endif @@ -172,6 +176,7 @@ void WS2812FX::setUpMatrix() { } } +#if 0 // WLEDMM this test is too early - ledmap will be loaded later #ifdef WLED_ENABLE_HUB75MATRIX // softhack007 hack: delete mapping table in case it only contains "identity" if (customMappingTable != nullptr && customMappingTableSize > 0) { @@ -188,6 +193,7 @@ void WS2812FX::setUpMatrix() { } } #endif +#endif #else isMatrix = false; // no matter what config says