aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2022-01-10 19:26:01 +0000
committermrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2022-01-10 19:26:01 +0000
commitc4129bf0bdcae66657e944110c5c23f78cdeb644 (patch)
tree2001742eb5e5dc681fc51d043a25b2604cfe0598
parent4dd02329c83671055bcd3ee4918551c47ab6458a (diff)
Update ESP32-VirtualMatrixPanel-I2S-DMA.h
Implemented changes as proposed by @danieldecesaro in #204
-rw-r--r--ESP32-VirtualMatrixPanel-I2S-DMA.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/ESP32-VirtualMatrixPanel-I2S-DMA.h b/ESP32-VirtualMatrixPanel-I2S-DMA.h
index 7228232..eac50bf 100644
--- a/ESP32-VirtualMatrixPanel-I2S-DMA.h
+++ b/ESP32-VirtualMatrixPanel-I2S-DMA.h
@@ -34,7 +34,7 @@ struct VirtualCoords {
};
-enum PANEL_SCAN_RATE {NORMAL_ONE_SIXTEEN, ONE_EIGHT};
+enum PANEL_SCAN_RATE {NORMAL_ONE_SIXTEEN, ONE_EIGHT_32, ONE_EIGHT_16};
#ifdef USE_GFX_ROOT
class VirtualMatrixPanel : public GFX
@@ -190,7 +190,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &x, int16_t &y) {
* the underlying hardware library is designed for (because
* there's only 2 x RGB pins... and convert this to 1/8 or something
*/
- if ( _panelScanRate == ONE_EIGHT)
+ if ( _panelScanRate == ONE_EIGHT_32)
{
/* Convert Real World 'VirtualMatrixPanel' co-ordinates (i.e. Real World pixel you're looking at
on the panel or chain of panels, per the chaining configuration) to a 1/8 panels
@@ -224,6 +224,23 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &x, int16_t &y) {
Serial.print("to ("); Serial.print(coords.x, DEC); Serial.print(","); Serial.print(coords.y, DEC); Serial.println(") ");
*/
}
+
+
+ if ( _panelScanRate == ONE_EIGHT_16)
+ {
+ if ((y & 8) == 0) {
+ coords.x += (panelResX>>2) * (((coords.x & 0xFFF0)>>4)+1); // 1st, 3rd 'block' of 8 rows of pixels, offset by panel width in DMA buffer
+ } else {
+ coords.x += (panelResX>>2) * (((coords.x & 0xFFF0)>>4)); // 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
+ }
+
+ if (y < 32)
+ coords.y = (y >> 4) * 8 + (y & 0b00000111);
+ else{
+ coords.y = ((y-32) >> 4) * 8 + (y & 0b00000111);
+ coords.x += 256;
+ }
+ }
//Serial.print("Mapping to x: "); Serial.print(coords.x, DEC); Serial.print(", y: "); Serial.println(coords.y, DEC);