Compile fix.

Use virtualLength() in getPixelColor()
This commit is contained in:
Blaz Kristan 2022-07-04 10:30:49 +02:00
parent 8b58d96aea
commit e2b7b228c5
4 changed files with 799 additions and 799 deletions

View File

@ -135,7 +135,7 @@ uint16_t IRAM_ATTR WS2812FX::get2DPixelIndex(uint16_t x, uint16_t y, uint8_t seg
return ((_segments[seg].startY + y) * matrixWidth) + _segments[seg].start + x;
}
void IRAM_ATTR WS2812FX::setPixelColorXY(uint16_t x, uint16_t y, byte r, byte g, byte b, byte w)
void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, byte r, byte g, byte b, byte w)
{
if (!isMatrix) return; // not a matrix set-up

View File

@ -521,14 +521,15 @@ uint8_t WS2812FX::getActiveSegmentsNum(void) {
uint32_t WS2812FX::getPixelColor(uint16_t i)
{
if (isMatrix) return getPixelColorXY(i, 0);
if (isMatrix) return getPixelColorXY(i%matrixWidth, i/matrixWidth); // compatibility w/ non-effect fn
// get physical pixel
i = i * SEGMENT.groupLength();;
if (SEGMENT.getOption(SEG_OPTION_REVERSED)) {
if (SEGMENT.getOption(SEG_OPTION_MIRROR)) i = (SEGMENT.length() - 1) / 2 - i; //only need to index half the pixels
else i = (SEGMENT.length() - 1) - i;
}
if (SEGMENT.getOption(SEG_OPTION_REVERSED)) i = SEGMENT.virtualLength() - i - 1;
i *= SEGMENT.groupLength();
//if (SEGMENT.getOption(SEG_OPTION_REVERSED)) {
// if (SEGMENT.getOption(SEG_OPTION_MIRROR)) i = (SEGMENT.length() - 1) / 2 - i; //only need to index half the pixels
// else i = (SEGMENT.length() - 1) - i;
//}
i += SEGMENT.start;
if (SEGLEN) {

View File

@ -605,7 +605,6 @@ function parseInfo(i) {
mh = i.leds.matrix ? i.leds.matrix.h : 0;
isM = mw>0 && mh>0;
if (!isM) hideModes("2D ");
else gId('buttonSr').classList.add("hide"); // peek does not work in 2D
if (!i.u || !i.u.AudioReactive) { /*hideModes("♪ ");*/ hideModes("♫ "); } // hide /*audio*/ frequency reactive effects
}

File diff suppressed because it is too large Load Diff