From 4da32466a83eb9831706f8d97c541778cc66fe7b Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Thu, 19 Feb 2026 17:48:39 -0800 Subject: [PATCH] feat: add debug touch drawing function and fix dashboard layout calculations --- boards/esp32-32e-4/DisplayDriverTFT.cpp | 2 +- boards/esp32-32e/DisplayDriverTFT.cpp | 6 ++++++ boards/esp32-32e/DisplayDriverTFT.h | 3 +++ boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp | 2 +- boards/esp32-s3-lcd-43/board_config.h | 2 +- mise.toml | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/boards/esp32-32e-4/DisplayDriverTFT.cpp b/boards/esp32-32e-4/DisplayDriverTFT.cpp index 5fcf64d..92c04a9 100644 --- a/boards/esp32-32e-4/DisplayDriverTFT.cpp +++ b/boards/esp32-32e-4/DisplayDriverTFT.cpp @@ -221,7 +221,7 @@ void DisplayDriverTFT::drawDashboard(const ScreenState& st) { _tft.print(st.wifiSsid.length() > 0 ? "WiFi:ON" : "WiFi:OFF"); // Get tile layouts from library helper - int tileCount = display.calculateDashboardLayouts(30, 8); + int tileCount = display.calculateDashboardLayouts(STYLE_HEADER_HEIGHT, STYLE_TILE_GAP); const TileLayout* layouts = display.getTileLayouts(); const char* tileLabels[] = { "Alert", "Silent", "Status", "Reboot" }; diff --git a/boards/esp32-32e/DisplayDriverTFT.cpp b/boards/esp32-32e/DisplayDriverTFT.cpp index b6aa745..6c68333 100644 --- a/boards/esp32-32e/DisplayDriverTFT.cpp +++ b/boards/esp32-32e/DisplayDriverTFT.cpp @@ -326,3 +326,9 @@ HoldState DisplayDriverTFT::updateHold(unsigned long holdMs) { } return h; } + +void DisplayDriverTFT::drawDebugTouch(int x, int y) { + const int size = 20; + _tft.drawLine(x - size, y, x + size, y, TFT_RED); + _tft.drawLine(x, y - size, x, y + size, TFT_RED); +} diff --git a/boards/esp32-32e/DisplayDriverTFT.h b/boards/esp32-32e/DisplayDriverTFT.h index 8739ff4..3afa73b 100644 --- a/boards/esp32-32e/DisplayDriverTFT.h +++ b/boards/esp32-32e/DisplayDriverTFT.h @@ -22,6 +22,9 @@ public: void setLabelFont() override; void setDefaultFont() override; + // Debug + void drawDebugTouch(int x, int y) override; + private: void drawBoot(const ScreenState& st); void drawAlert(const ScreenState& st); diff --git a/boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp b/boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp index 937fd76..cc9493d 100644 --- a/boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp +++ b/boards/esp32-s3-lcd-43/DisplayDriverGFX.cpp @@ -407,7 +407,7 @@ void DisplayDriverGFX::drawDashboard(const ScreenState& state) { _gfx->printf("WiFi:%s", state.wifiSsid.length() > 0 ? "ON" : "OFF"); // Get tile layouts from library helper - int tileCount = display.calculateDashboardLayouts(30, 8); + int tileCount = display.calculateDashboardLayouts(STYLE_HEADER_HEIGHT, STYLE_TILE_GAP); const TileLayout* layouts = display.getTileLayouts(); const char* tileLabels[] = { "1", "2", "3", "4", "5", "6", "7", "8" }; diff --git a/boards/esp32-s3-lcd-43/board_config.h b/boards/esp32-s3-lcd-43/board_config.h index f533537..d6bc5a3 100644 --- a/boards/esp32-s3-lcd-43/board_config.h +++ b/boards/esp32-s3-lcd-43/board_config.h @@ -43,7 +43,7 @@ // Spacing #define STYLE_SPACING_X 10 #define STYLE_SPACING_Y 10 -#define STYLE_HEADER_HEIGHT 40 +#define STYLE_HEADER_HEIGHT 45 #define STYLE_TILE_GAP 8 #define STYLE_TILE_PADDING 16 #define STYLE_TILE_RADIUS 8 diff --git a/mise.toml b/mise.toml index 059cbc7..ee02db6 100644 --- a/mise.toml +++ b/mise.toml @@ -215,4 +215,4 @@ echo "[OK] Generated .crush.json with FQBN: $FQBN" run = "git add .; lumen draft | git commit -F - " [env] -BOARD = "esp32-s3-lcd-43" +BOARD = "esp32-32e-4"