From c1738936a9489d652810af56e1985c79affcd724 Mon Sep 17 00:00:00 2001 From: mhwlng Date: Sun, 3 Nov 2024 19:33:29 +0100 Subject: [PATCH] change endianness lilygo t-panel in Arduino_ESP32RGBPanel to get rid of looping over all pixels (#388) --- ESP32_AP-Flasher/src/ips_display.cpp | 33 +++------------------------- ESP32_AP-Flasher/src/makeimage.cpp | 12 +--------- 2 files changed, 4 insertions(+), 41 deletions(-) diff --git a/ESP32_AP-Flasher/src/ips_display.cpp b/ESP32_AP-Flasher/src/ips_display.cpp index 2cfa42b0..610ed333 100644 --- a/ESP32_AP-Flasher/src/ips_display.cpp +++ b/ESP32_AP-Flasher/src/ips_display.cpp @@ -162,7 +162,7 @@ Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel( LCD_R0 /* R0 */, LCD_R1 /* R1 */, LCD_R2 /* R2 */, LCD_R3 /* R3 */, LCD_R4 /* R4 */, 1 /* hsync_polarity */, 20 /* hsync_front_porch */, 2 /* hsync_pulse_width */, 0 /* hsync_back_porch */, 1 /* vsync_polarity */, 30 /* vsync_front_porch */, 8 /* vsync_pulse_width */, 1 /* vsync_back_porch */, - 10 /* pclk_active_neg */, 6000000L /* prefer_speed */, false /* useBigEndian */, + 10 /* pclk_active_neg */, 6000000L /* prefer_speed */, true /* useBigEndian */, 0 /* de_idle_high*/, 0 /* pclk_idle_high */); Arduino_RGB_Display *gfx = new Arduino_RGB_Display( LCD_WIDTH /* width */, LCD_HEIGHT /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */, @@ -182,24 +182,7 @@ void TFTLog(String text) { tftLogscreen = true; } if (text.isEmpty()) return; - gfx->setTextColor(LIGHTGREY); - if (text.startsWith("!")) { - gfx->setTextColor(RED); - text = text.substring(1); - } else if (text.indexOf("http") != -1) { - int httpIndex = text.indexOf("http"); - gfx->print(text.substring(0, httpIndex)); - gfx->setTextColor(YELLOW); - text = text.substring(httpIndex); - } else if (text.indexOf(":") != -1) { - int colonIndex = text.indexOf(":"); - gfx->setTextColor(LIGHTGREY); - gfx->print(text.substring(0, colonIndex + 1)); - gfx->setTextColor(WHITE); - text = text.substring(colonIndex + 1); - } else if (text.endsWith("!")) { - gfx->setTextColor(GREEN); - } + gfx->setTextColor(WHITE); gfx->println(text); #else @@ -361,17 +344,7 @@ void yellow_ap_display_loop(void) { long dx = spr.width(); uint16_t* data = static_cast(const_cast(spriteData)); - - for (int16_t j = 0; j < dy; j++) - { - for (int16_t i = 0; i < dx; i++) - { - uint16_t color = *data; - color = color<<8 | color>>8; - *data = color; - data++; - } - } + gfx->draw16bitRGBBitmap(0, 0, (uint16_t *)spriteData, dx, dy); spr.deleteSprite(); #else diff --git a/ESP32_AP-Flasher/src/makeimage.cpp b/ESP32_AP-Flasher/src/makeimage.cpp index 70bb7d40..b02a1a3e 100644 --- a/ESP32_AP-Flasher/src/makeimage.cpp +++ b/ESP32_AP-Flasher/src/makeimage.cpp @@ -294,17 +294,7 @@ void spr2buffer(TFT_eSprite &spr, String &fileout, imgParam &imageParams) { long dx = spr.width(); uint16_t* data = static_cast(const_cast(spriteData2)); - - for (int16_t j = 0; j < dy; j++) - { - for (int16_t i = 0; i < dx; i++) - { - uint16_t color = *data; - color = color<<8 | color>>8; - *data = color; - data++; - } - } + gfx->draw16bitRGBBitmap(0, 0, (uint16_t *)spriteData2, dx, dy); spr2.deleteSprite(); }