From afcc7b6a567bcd5e1288ed98c9d9bb6939e5f5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 19 Sep 2022 16:18:01 +0200 Subject: [PATCH 1/2] Always use the latest framework for ESP32 --- arch/esp32/esp32.ini | 2 -- arch/esp32/esp32s3.ini | 3 --- 2 files changed, 5 deletions(-) diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 77b747a1e..49ff1054d 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -36,8 +36,6 @@ lib_deps = lib_ignore = segger_rtt ESP32 BLE Arduino -platform_packages = - framework-arduinoespressif32 ; leave this commented out to avoid breaking Windows ;upload_port = /dev/ttyUSB0 diff --git a/arch/esp32/esp32s3.ini b/arch/esp32/esp32s3.ini index 0497f1c95..4e2817184 100644 --- a/arch/esp32/esp32s3.ini +++ b/arch/esp32/esp32s3.ini @@ -32,13 +32,10 @@ lib_deps = h2zero/NimBLE-Arduino@1.4.0 arduino-libraries/NTPClient@^3.1.0 https://github.com/lewisxhe/XPowersLib.git - lib_ignore = segger_rtt ESP32 BLE Arduino -platform_packages = - framework-arduinoespressif32@ 3.20004.220825 ; customize the partition table ; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables From ed90275370e07dbd3d3d592e6335e3c57a4f8f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 19 Sep 2022 16:57:18 +0200 Subject: [PATCH 2/2] use double buffering on TFT screens --- src/graphics/TFTDisplay.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index dec496313..1d5f43cd1 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -22,13 +22,23 @@ void TFTDisplay::display(void) { concurrency::LockGuard g(spiLock); - // FIXME - only draw bits have changed (use backbuf similar to the other displays) - // tft.drawBitmap(0, 0, buffer, 128, 64, TFT_YELLOW, TFT_BLACK); - for (uint16_t y = 0; y < displayHeight; y++) { - for (uint16_t x = 0; x < displayWidth; x++) { + uint16_t x,y; + + for (y = 0; y < displayHeight; y++) { + for (x = 0; x < displayWidth; x++) { // get src pixel in the page based ordering the OLED lib uses FIXME, super inefficent auto isset = buffer[x + (y / 8) * displayWidth] & (1 << (y & 7)); - tft.drawPixel(x, y, isset ? TFT_WHITE : TFT_BLACK); + auto dblbuf_isset = buffer_back[x + (y / 8) * displayWidth] & (1 << (y & 7)); + if (isset != dblbuf_isset) { + tft.drawPixel(x, y, isset ? TFT_WHITE : TFT_BLACK); + } + } + } + // Copy the Buffer to the Back Buffer + for (y = 0; y < (displayHeight / 8); y++) { + for (x = 0; x < displayWidth; x++) { + uint16_t pos = x + y * displayWidth; + buffer_back[pos] = buffer[pos]; } } }