Fix for 2D peek.
This commit is contained in:
parent
bfbff723ac
commit
348c4b4431
@ -250,6 +250,8 @@ void /*IRAM_ATTR*/ WS2812FX::setPixelColorXY(float x, float y, byte r, byte g, b
|
|||||||
|
|
||||||
// returns RGBW values of pixel
|
// returns RGBW values of pixel
|
||||||
uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) {
|
uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) {
|
||||||
|
uint16_t index;
|
||||||
|
if (SEGLEN) {
|
||||||
if (SEGMENT.getOption(SEG_OPTION_REVERSED) ) x = SEGMENT.virtualWidth() - x - 1;
|
if (SEGMENT.getOption(SEG_OPTION_REVERSED) ) x = SEGMENT.virtualWidth() - x - 1;
|
||||||
if (SEGMENT.getOption(SEG_OPTION_REVERSED_Y)) y = SEGMENT.virtualHeight() - y - 1;
|
if (SEGMENT.getOption(SEG_OPTION_REVERSED_Y)) y = SEGMENT.virtualHeight() - y - 1;
|
||||||
if (SEGMENT.getOption(SEG_OPTION_TRANSPOSED)) { uint16_t t = x; x = y; y = t; } // swap X & Y if segment transposed
|
if (SEGMENT.getOption(SEG_OPTION_TRANSPOSED)) { uint16_t t = x; x = y; y = t; } // swap X & Y if segment transposed
|
||||||
@ -258,10 +260,10 @@ uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) {
|
|||||||
y *= SEGMENT.groupLength(); // expand to physical pixels
|
y *= SEGMENT.groupLength(); // expand to physical pixels
|
||||||
if (x >= SEGMENT.width() || y >= SEGMENT.height()) return 0;
|
if (x >= SEGMENT.width() || y >= SEGMENT.height()) return 0;
|
||||||
|
|
||||||
//if (SEGMENT.getOption(SEG_OPTION_REVERSED) ) x = SEGMENT.width() - x - 1;
|
index = get2DPixelIndex(x, y);
|
||||||
//if (SEGMENT.getOption(SEG_OPTION_REVERSED_Y)) y = SEGMENT.height() - y - 1;
|
} else {
|
||||||
|
index = y * matrixWidth + x;
|
||||||
uint16_t index = get2DPixelIndex(x, y);
|
}
|
||||||
if (index < customMappingSize) index = customMappingTable[index];
|
if (index < customMappingSize) index = customMappingTable[index];
|
||||||
|
|
||||||
return busses.getPixelColor(index);
|
return busses.getPixelColor(index);
|
||||||
|
Loading…
Reference in New Issue
Block a user