aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrcodetastic <12006953+mrcodetastic@users.noreply.github.com>2025-02-08 15:10:51 +0000
committerGitHub <noreply@github.com>2025-02-08 15:10:51 +0000
commit9da34a722550b711981dad5cc7a70096d6589013 (patch)
tree8212e9385074f6c3a6ed50509fba4fad7887f866
parente369f0ddb8db6d573a4664ebeeee70615e6eb218 (diff)
parent0e5c84da78d041863c90d21f8c18db3139fa1e3f (diff)
Merge pull request #747 from j-g00da/scan_rate_pixel_base
Settable pixel-base
-rw-r--r--src/ESP32-VirtualMatrixPanel-I2S-DMA.h43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h
index f6df7ab..0ad453b 100644
--- a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h
+++ b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h
@@ -97,6 +97,7 @@ public:
panelResX = _panelResX;
panelResY = _panelResY;
+ panel_pixel_base = _panelResX;
vmodule_rows = _vmodule_rows;
vmodule_cols = _vmodule_cols;
@@ -135,8 +136,8 @@ public:
#endif
#ifdef NO_GFX
- inline int16_t width() const { return _virtualResX; }
- inline int16_t height() const { return _virtualResY; }
+ inline uint16_t width() const { return _virtualResX; }
+ inline uint16_t height() const { return _virtualResY; }
#endif
uint16_t color444(uint8_t r, uint8_t g, uint8_t b)
@@ -150,12 +151,14 @@ public:
void drawDisplayTest();
void setPhysicalPanelScanRate(PANEL_SCAN_RATE rate);
+ void setPhysicalPanelScanRate(PANEL_SCAN_RATE rate, uint8_t pixel_base);
void setZoomFactor(int scale);
virtual VirtualCoords getCoords(int16_t x, int16_t y);
VirtualCoords coords;
- int16_t panelResX;
- int16_t panelResY;
+ uint8_t panelResX;
+ uint8_t panelResY;
+ uint8_t panel_pixel_base;
private:
MatrixPanel_I2S_DMA *display;
@@ -163,17 +166,17 @@ private:
PANEL_CHAIN_TYPE panel_chain_type;
PANEL_SCAN_RATE panel_scan_rate = NORMAL_TWO_SCAN;
- int16_t virtualResX; ///< Display width as combination of panels
- int16_t virtualResY; ///< Display height as combination of panels
+ uint16_t virtualResX; ///< Display width as combination of panels
+ uint16_t virtualResY; ///< Display height as combination of panels
- int16_t _virtualResX; ///< Display width as modified by current rotation
- int16_t _virtualResY; ///< Display height as modified by current rotation
+ uint16_t _virtualResX; ///< Display width as modified by current rotation
+ uint16_t _virtualResY; ///< Display height as modified by current rotation
- int16_t vmodule_rows;
- int16_t vmodule_cols;
+ uint8_t vmodule_rows;
+ uint8_t vmodule_cols;
- int16_t dmaResX; // The width of the chain in pixels (as the DMA engine sees it)
+ uint16_t dmaResX; // The width of the chain in pixels (as the DMA engine sees it)
int _rotate = 0;
@@ -395,10 +398,10 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
if ((coords.y & 8) == 0)
// 1st, 3rd 'block' of 8 rows of pixels, offset by panel width in DMA buffer
- coords.x += ((coords.x / panelResX) + 1) * panelResX;
+ coords.x += ((coords.x / panel_pixel_base) + 1) * panel_pixel_base;
else
// 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
- coords.x += (coords.x / panelResX) * panelResX;
+ coords.x += (coords.x / panel_pixel_base) * panel_pixel_base;
// http://cpp.sh/4ak5u
// Real number of DMA y rows is half reality
@@ -408,17 +411,17 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
case FOUR_SCAN_16PX_HIGH:
if ((coords.y & 4) == 0)
// 1st, 3rd 'block' of 8 rows of pixels, offset by panel width in DMA buffer
- coords.x += ((coords.x / panelResX) + 1) * panelResX;
+ coords.x += ((coords.x / panel_pixel_base) + 1) * panel_pixel_base;
else
// 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
- coords.x += (coords.x / panelResX) * panelResX;
+ coords.x += (coords.x / panel_pixel_base) * panel_pixel_base;
coords.y = (coords.y >> 3) * 4 + (coords.y & 0b00000011);
break;
case FOUR_SCAN_40PX_HIGH:
if ((coords.y / 10) % 2 == 0)
- coords.x += ((coords.x / panelResX) + 1) * panelResX;
+ coords.x += ((coords.x / panel_pixel_base) + 1) * panel_pixel_base;
else
- coords.x += (coords.x / panelResX) * panelResX;
+ coords.x += (coords.x / panel_pixel_base) * panel_pixel_base;
coords.y = (coords.y / 20) * 10 + (coords.y % 10);
break;
default:
@@ -524,6 +527,12 @@ inline void VirtualMatrixPanel::setPhysicalPanelScanRate(PANEL_SCAN_RATE rate)
panel_scan_rate = rate;
}
+inline void VirtualMatrixPanel::setPhysicalPanelScanRate(PANEL_SCAN_RATE rate, uint8_t pixel_base)
+{
+ panel_scan_rate = rate;
+ panel_pixel_base = pixel_base;
+}
+
inline void VirtualMatrixPanel::setZoomFactor(int scale)
{
if(scale < 5 && scale > 0)