Update ESP32-VirtualMatrixPanel-I2S-DMA.h

This commit is contained in:
mrfaptastic 2023-03-18 11:36:37 +00:00
parent 264d997618
commit 7d1841e355

View file

@ -46,7 +46,8 @@ struct VirtualCoords
enum PANEL_SCAN_RATE
{
NORMAL_TWO_SCAN, NORMAL_ONE_SIXTEEN, // treated as the same
NORMAL_TWO_SCAN,
NORMAL_ONE_SIXTEEN, // treated as the same
FOUR_SCAN_32PX_HIGH,
FOUR_SCAN_16PX_HIGH
};
@ -54,6 +55,7 @@ enum PANEL_SCAN_RATE
// Chaining approach... From the perspective of the DISPLAY / LED side of the chain of panels.
enum PANEL_CHAIN_TYPE
{
CHAIN_NONE,
CHAIN_TOP_LEFT_DOWN,
CHAIN_TOP_RIGHT_DOWN,
CHAIN_BOTTOM_LEFT_UP,
@ -74,8 +76,7 @@ class VirtualMatrixPanel
{
public:
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_TOP_RIGHT_DOWN)
VirtualMatrixPanel(MatrixPanel_I2S_DMA &disp, int _vmodule_rows, int _vmodule_cols, int _panelResX, int _panelResY, PANEL_CHAIN_TYPE _panel_chain_type = CHAIN_NONE)
#ifdef USE_GFX_ROOT
: GFX(_vmodule_cols * _panelResX, _vmodule_rows * _panelResY)
#elif !defined NO_GFX
@ -121,7 +122,10 @@ public:
void drawPixel(int16_t x, int16_t y, CRGB color);
#endif
uint16_t color444(uint8_t r, uint8_t g, uint8_t b) { return display->color444(r, g, b); }
uint16_t color444(uint8_t r, uint8_t g, uint8_t b)
{
return display->color444(r, g, b);
}
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return display->color565(r, g, b); }
uint16_t color333(uint8_t r, uint8_t g, uint8_t b) { return display->color333(r, g, b); }
@ -198,7 +202,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
coords.x = ((vmodule_rows - (row + 1)) * virtualResX) + virt_x;
coords.y = virt_y % panelResY;
}
}
break;
@ -241,7 +244,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
}
break;
case (CHAIN_BOTTOM_LEFT_UP): //
{
row = vmodule_rows - row - 1;
@ -259,7 +261,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
coords.x = dmaResX - (row * virtualResX) - virt_x;
coords.y = panelResY - 1 - (virt_y % panelResY);
}
}
break;
@ -291,7 +292,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
coords.x = dmaResX - (row * virtualResX) - virt_x;
coords.y = panelResY - 1 - (virt_y % panelResY);
}
}
break;
@ -307,15 +307,14 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
}
break;
// Q: 1 row!? Why?
// A: In cases people are only using virtual matrix panel for panels of non-standard scan rates.
default:
coords.x = coords.y = -1; // By defalt use an invalid co-ordinates that will be rejected by updateMatrixDMABuffer
return coords;
coords.x = virt_x; coords.y = virt_y;
break;
} // end switch
/* START: Pixel remapping AGAIN to convert TWO parallel scanline output that the
* the underlying hardware library is designed for (because
* there's only 2 x RGB pins... and convert this to 1/4 or something
@ -344,7 +343,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
// Real number of DMA y rows is half reality
// coords.y = (y / 16)*8 + (y & 0b00000111);
coords.y = (virt_y >> 4) * 8 + (virt_y & 0b00000111);
}
else if (panel_scan_rate == FOUR_SCAN_16PX_HIGH)
{