last leds flahses wierdly

This commit is contained in:
2026-02-04 09:41:32 +01:00
parent 0903121e61
commit 5b82e5a41e
5 changed files with 101 additions and 28 deletions
+12 -12
View File
@@ -108,8 +108,8 @@ void drawCharacterPart(const bool* character_row, unsigned char height, uint32_t
short pixel_x = col + start_x;
short pixel_y = start_y;
if (pixel_x >= 0 && pixel_x <= PANEL_MAX_X &&
pixel_y >= 0 && pixel_y <= PANEL_MAX_Y)
if (pixel_x >= 0 && pixel_x <= DISPLAY_MAX_X &&
pixel_y >= 0 && pixel_y <= DISPLAY_MAX_Y)
{
setPixel(pixel_x, pixel_y, color);
}
@@ -170,7 +170,7 @@ void shiftGivenRectangleLeft(short x1, short y1, short x2, short y2, unsigned ch
for (short i = 0; i < height; i++)
{
short y = y1 + i;
if (y < 0 || y > PANEL_MAX_Y) continue;
if (y < 0 || y > DISPLAY_MAX_Y) continue;
for (short j = 0; j < width; j++)
{
@@ -178,20 +178,20 @@ void shiftGivenRectangleLeft(short x1, short y1, short x2, short y2, unsigned ch
short dest_x = src_x - shift_by;
uint32_t color = 0;
if (src_x >= 0 && src_x <= PANEL_MAX_X) {
if (src_x >= 0 && src_x <= DISPLAY_MAX_X) {
color = getPixelColor(src_x, y);
}
if (dest_x >= 0 && dest_x <= PANEL_MAX_X) {
if (dest_x >= 0 && dest_x <= DISPLAY_MAX_X) {
setPixel(dest_x, y, color);
}
}
}
// Clear the trailing edge that was shifted from
for (short y = y1; y <= y2; y++) {
if (y < 0 || y > PANEL_MAX_Y) continue;
if (y < 0 || y > DISPLAY_MAX_Y) continue;
for (short x = x2 - shift_by + 1; x <= x2; x++) {
if (x >= 0 && x <= PANEL_MAX_X) {
if (x >= 0 && x <= DISPLAY_MAX_X) {
setPixel(x, y, 0);
}
}
@@ -219,7 +219,7 @@ void shiftGivenRectangleRight(short x1, short y1, short x2, short y2, unsigned c
for (short i = 0; i < height; i++)
{
short y = y1 + i;
if (y < 0 || y > PANEL_MAX_Y) continue;
if (y < 0 || y > DISPLAY_MAX_Y) continue;
for (short j = width - 1; j >= 0; j--)
{
@@ -227,20 +227,20 @@ void shiftGivenRectangleRight(short x1, short y1, short x2, short y2, unsigned c
short dest_x = src_x + shift_by;
uint32_t color = 0;
if (src_x >= 0 && src_x <= PANEL_MAX_X) {
if (src_x >= 0 && src_x <= DISPLAY_MAX_X) {
color = getPixelColor(src_x, y);
}
if (dest_x >= 0 && dest_x <= PANEL_MAX_X) {
if (dest_x >= 0 && dest_x <= DISPLAY_MAX_X) {
setPixel(dest_x, y, color);
}
}
}
// Clear the trailing edge that was shifted from
for (short y = y1; y <= y2; y++) {
if (y < 0 || y > PANEL_MAX_Y) continue;
if (y < 0 || y > DISPLAY_MAX_Y) continue;
for (short x = x1; x < x1 + shift_by; x++) {
if (x >= 0 && x <= PANEL_MAX_X) {
if (x >= 0 && x <= DISPLAY_MAX_X) {
setPixel(x, y, 0);
}
}