Enable Peek for 2D.

This commit is contained in:
Blaz Kristan 2022-07-04 11:12:55 +02:00
parent 0a2e01a616
commit febd7cbca8
5 changed files with 811 additions and 809 deletions

View File

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

View File

@ -521,14 +521,15 @@ uint8_t WS2812FX::getActiveSegmentsNum(void) {
uint32_t WS2812FX::getPixelColor(uint16_t i) 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 // get physical pixel
i = i * SEGMENT.groupLength();; if (SEGMENT.getOption(SEG_OPTION_REVERSED)) i = SEGMENT.virtualLength() - i - 1;
if (SEGMENT.getOption(SEG_OPTION_REVERSED)) { i *= SEGMENT.groupLength();
if (SEGMENT.getOption(SEG_OPTION_MIRROR)) i = (SEGMENT.length() - 1) / 2 - i; //only need to index half the pixels //if (SEGMENT.getOption(SEG_OPTION_REVERSED)) {
else i = (SEGMENT.length() - 1) - i; // 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; i += SEGMENT.start;
if (SEGLEN) { if (SEGLEN) {

View File

@ -605,7 +605,6 @@ function parseInfo(i) {
mh = i.leds.matrix ? i.leds.matrix.h : 0; mh = i.leds.matrix ? i.leds.matrix.h : 0;
isM = mw>0 && mh>0; isM = mw>0 && mh>0;
if (!isM) hideModes("2D "); 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 if (!i.u || !i.u.AudioReactive) { /*hideModes("♪ ");*/ hideModes("♫ "); } // hide /*audio*/ frequency reactive effects
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2207031 #define VERSION 2207041
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG