From d42f24207d43e02f175a73f957bfeee7bb2bab97 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Fri, 10 Feb 2023 16:57:07 +0100 Subject: [PATCH] Ledmaps bugfix --- wled00/FX_2Dfcn.cpp | 6 ++++-- wled00/FX_fcn.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index d8d7fd45..7837322c 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -95,8 +95,10 @@ void WS2812FX::setUpMatrix(bool reset) { x = p.serpentine && j%2 ? h-x-1 : x; uint16_t index = (p.yOffset + (p.vertical?x:y)) * Segment::maxWidth + p.xOffset + (p.vertical?y:x); if (loadedLedmap > 0) { - if (index < customMappingSizeLedmap) - customMappingTableCombi[customMappingTable[index]] = pix; //WLEDMM: allow for 2 transitions if reset = false (ledmap and logical to physical) + if (index < customMappingSizeLedmap) { + if (customMappingTable[index] < customMappingSize) + customMappingTableCombi[customMappingTable[index]] = pix; //WLEDMM: allow for 2 transitions if reset = false (ledmap and logical to physical) + } else customMappingTableCombi[index] = pix; } diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index a368270f..2358b9b9 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1971,14 +1971,15 @@ void WS2812FX::deserializeMap(uint8_t n) { customMappingTable[i] = (uint16_t) 0xFFFFU; //fill the map entirely } loadedLedmap = n; - #ifdef WLED_DEBUG + + #ifdef WLED_DEBUG DEBUG_PRINTF("Custom ledmap: %d\n", loadedLedmap); for (uint16_t i=0; i