From 5ffb913d5682a35d948866d6451bf5eb8e80a7d0 Mon Sep 17 00:00:00 2001 From: mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> Date: Wed, 9 Jun 2021 10:15:49 +0100 Subject: [PATCH] Update ESP32-VirtualMatrixPanel-I2S-DMA.h --- ESP32-VirtualMatrixPanel-I2S-DMA.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ESP32-VirtualMatrixPanel-I2S-DMA.h b/ESP32-VirtualMatrixPanel-I2S-DMA.h index eba4e95..32bb8a1 100644 --- a/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -107,7 +107,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t x, int16_t y) { coords.x = coords.y = -1; // By defalt use an invalid co-ordinates that will be rejected by updateMatrixDMABuffer - if (x < 0 || x > width() || y < 0 || y > height() ) { + if (x < 0 || x >= width() || y < 0 || y >= height() ) { //Serial.printf("VirtualMatrixPanel::getCoords(): Invalid virtual display coordinate. x,y: %d, %d\r\n", x, y); return coords; } @@ -127,7 +127,8 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t x, int16_t y) { { // First portion gets you to the correct offset for the row you need // Second portion inverts the x on the row - coords.x = (y / panelResY) * (module_cols * panelResX) + (virtualResX - 1 - x); + //coords.x = (y / panelResY) * (module_cols * panelResX) + (virtualResX - 1 - x); + coords.x = (y / panelResY) * (module_cols * panelResX) + (virtualResX - 0 - x); // hack untested 9/june/21 // inverts the y the row coords.y = panelResY - 1 - (y % panelResY);