@@ -47,11 +47,11 @@ void LedMatrix::SetCurrentScalingMode(uint8_t mode) {}
4747
4848void LedMatrix::DrawPixel (uint16_t x, uint16_t y, uint8_t r, uint8_t g,
4949 uint8_t b) {
50- dma_display->drawPixelRGB888 (x, y, r, g, b);
50+ dma_display->drawPixelRGB888 (x, y + yOffset , r, g, b);
5151}
5252
5353void LedMatrix::DrawPixel (uint16_t x, uint16_t y, uint16_t color) {
54- dma_display->drawPixel (x, y, color);
54+ dma_display->drawPixel (x, y + yOffset , color);
5555}
5656
5757void LedMatrix::ClearScreen () { dma_display->clearScreen (); }
@@ -78,48 +78,48 @@ void LedMatrix::DisplayText(const char *text, uint16_t x, uint16_t y, uint8_t r,
7878 if (transparent && !p) {
7979 continue ;
8080 }
81- dma_display->drawPixelRGB888 (x + pixel + (ti * 4 ), y + tj, r * p, g * p,
81+ dma_display->drawPixelRGB888 (x + pixel + (ti * 4 ), y + yOffset + tj, r * p, g * p,
8282 b * p);
8383 }
8484 }
8585 }
8686}
8787
8888void IRAM_ATTR LedMatrix::FillZoneRaw (uint8_t idx, uint8_t *pBuffer) {
89- const uint8_t yOffset = (idx / ZONES_PER_ROW) * ZONE_HEIGHT;
90- const uint8_t xOffset = (idx % ZONES_PER_ROW) * ZONE_WIDTH;
89+ const uint8_t zoneYOffset = (idx / ZONES_PER_ROW) * ZONE_HEIGHT;
90+ const uint8_t zoneXOffset = (idx % ZONES_PER_ROW) * ZONE_WIDTH;
9191
9292 for (uint8_t y = 0 ; y < ZONE_HEIGHT; y++) {
9393 for (uint8_t x = 0 ; x < ZONE_WIDTH; x++) {
9494 uint16_t pos = (y * ZONE_WIDTH + x) * 3 ;
9595
96- dma_display->drawPixelRGB888 (x + xOffset , y + yOffset, pBuffer[pos],
96+ dma_display->drawPixelRGB888 (x + zoneXOffset , y + zoneYOffset + yOffset, pBuffer[pos],
9797 pBuffer[pos + 1 ], pBuffer[pos + 2 ]);
9898 }
9999 }
100100}
101101
102102void IRAM_ATTR LedMatrix::FillZoneRaw565 (uint8_t idx, uint8_t *pBuffer) {
103- const uint8_t yOffset = (idx / ZONES_PER_ROW) * ZONE_HEIGHT;
104- const uint8_t xOffset = (idx % ZONES_PER_ROW) * ZONE_WIDTH;
103+ const uint8_t zoneYOffset = (idx / ZONES_PER_ROW) * ZONE_HEIGHT;
104+ const uint8_t zoneXOffset = (idx % ZONES_PER_ROW) * ZONE_WIDTH;
105105
106106 for (uint8_t y = 0 ; y < ZONE_HEIGHT; y++) {
107107 for (uint8_t x = 0 ; x < ZONE_WIDTH; x++) {
108108 uint16_t pos = (y * ZONE_WIDTH + x) * 2 ;
109109 dma_display->drawPixel (
110- x + xOffset , y + yOffset,
110+ x + zoneXOffset , y + zoneYOffset + yOffset,
111111 (((uint16_t )pBuffer[pos + 1 ]) << 8 ) + pBuffer[pos]);
112112 }
113113 }
114114}
115115
116116void IRAM_ATTR LedMatrix::ClearZone (uint8_t idx) {
117- const uint8_t yOffset = (idx / ZONES_PER_ROW) * ZONE_HEIGHT;
118- const uint8_t xOffset = (idx % ZONES_PER_ROW) * ZONE_WIDTH;
117+ const uint8_t zoneYOffset = (idx / ZONES_PER_ROW) * ZONE_HEIGHT;
118+ const uint8_t zoneXOffset = (idx % ZONES_PER_ROW) * ZONE_WIDTH;
119119
120120 for (uint8_t y = 0 ; y < ZONE_HEIGHT; y++) {
121121 for (uint8_t x = 0 ; x < ZONE_WIDTH; x++) {
122- dma_display->drawPixelRGB888 (x + xOffset , y + yOffset, 0 , 0 , 0 );
122+ dma_display->drawPixelRGB888 (x + zoneXOffset , y + zoneYOffset + yOffset, 0 , 0 , 0 );
123123 }
124124 }
125125}
@@ -131,7 +131,7 @@ void IRAM_ATTR LedMatrix::FillPanelRaw(uint8_t *pBuffer) {
131131 for (uint16_t x = 0 ; x < TOTAL_WIDTH; x++) {
132132 pos = (y * TOTAL_WIDTH + x) * 3 ;
133133
134- dma_display->drawPixelRGB888 (x, y, pBuffer[pos], pBuffer[pos + 1 ],
134+ dma_display->drawPixelRGB888 (x, y + yOffset , pBuffer[pos], pBuffer[pos + 1 ],
135135 pBuffer[pos + 2 ]);
136136 }
137137 }
0 commit comments