From b6db86da505a5155543bbfaac5b3f3890c22c232 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Wed, 23 Nov 2022 16:54:32 +0100 Subject: [PATCH] Allow matrix bigger than LED count (missing panels) --- wled00/FX_2Dfcn.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index 7159bcb05..c0c46888a 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -114,10 +114,11 @@ void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, uint32_t col) #ifndef WLED_DISABLE_2D if (!isMatrix) return; // not a matrix set-up uint16_t index = y * matrixWidth + x; + if (index >= customMappingSize) return; // customMappingSize is always W * H of matrix in 2D setup #else uint16_t index = x; -#endif if (index >= _length) return; +#endif if (index < customMappingSize) index = customMappingTable[index]; busses.setPixelColor(index, col); } @@ -126,10 +127,11 @@ void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, uint32_t col) uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) { #ifndef WLED_DISABLE_2D uint16_t index = (y * matrixWidth + x); + if (index >= customMappingSize) return 0; // customMappingSize is always W * H of matrix in 2D setup #else uint16_t index = x; -#endif if (index >= _length) return 0; +#endif if (index < customMappingSize) index = customMappingTable[index]; return busses.getPixelColor(index); }