aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormrcodetastic <12006953+mrcodetastic@users.noreply.github.com>2024-07-04 01:32:57 +0100
committerGitHub <noreply@github.com>2024-07-04 01:32:57 +0100
commit89dc02998f4d90ead1be762df3b383447cfb5bc2 (patch)
tree431dc7161cea65212203577ded5cc46f6f9a065f /src
parent54ef6071663325e7b8f3a9e1e0db89b0b0b7398d (diff)
parent459516b6db9c803360e32c0bd02ecd03b1a4a9a5 (diff)
Merge pull request #638 from board707/virtual_16px_high
Fix incorrect getCoords() for 16px_high panels, as mentioned in issue #635
Diffstat (limited to 'src')
-rw-r--r--src/ESP32-VirtualMatrixPanel-I2S-DMA.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h
index d73fa7c..cf92a87 100644
--- a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h
+++ b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h
@@ -389,7 +389,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
as if the panel is 2 * W and 0.5 * H !
*/
- if ((virt_y & 8) == 0)
+ if ((coords.y & 8) == 0)
{
coords.x += ((coords.x / panelResX) + 1) * panelResX; // 1st, 3rd 'block' of 8 rows of pixels, offset by panel width in DMA buffer
}
@@ -405,22 +405,15 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t virt_x, int16_t virt_
}
else if (panel_scan_rate == FOUR_SCAN_16PX_HIGH)
{
- if ((virt_y & 8) == 0)
+ if ((coords.y & 4) == 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
+ coords.x += ((coords.x / panelResX) + 1) * panelResX; // 1st, 3rd 'block' of 8 rows of pixels, offset by panel width in DMA buffer
}
-
- if (virt_y < 32)
- coords.y = (virt_y >> 4) * 8 + (virt_y & 0b00000111);
else
{
- coords.y = ((virt_y - 32) >> 4) * 8 + (virt_y & 0b00000111);
- coords.x += 256;
+ coords.x += (coords.x / panelResX) * panelResX; // 2nd, 4th 'block' of 8 rows of pixels, offset by panel width in DMA buffer
}
+ coords.y = (coords.y >> 3) * 4 + (coords.y & 0b00000011);
}
return coords;