Allow matrix bigger than LED count (missing panels)

This commit is contained in:
Blaz Kristan 2022-11-23 16:54:32 +01:00
parent 713509527a
commit b6db86da50

View File

@ -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);
}