refactor: move TileLayoutHelper from DisplayManager.h to Style.h

- Pure static helper class moved from DisplayManager.h to Style.h
- Drivers now use TileLayoutHelper::calculateLayouts() directly
- Remove extern DisplayManager references from display drivers
- Drop LGFX_USE_V1 build flag (no longer needed)
- Add delay(LOOP_YIELD_MS) in S3 loop to prevent watchdog
This commit is contained in:
2026-05-29 20:17:15 -07:00
parent 3d17e7bab9
commit 14781b8c07
6 changed files with 134 additions and 131 deletions
+6 -6
View File
@@ -3,8 +3,7 @@
#include <Arduino.h>
#include <KlubhausCore.h>
#include <TFT_eSPI.h>
extern DisplayManager display;
#include <Style.h>
// ── Fonts ───────────────────────────────────────────────────
// TFT_eSPI built-in fonts for 320x480 display (scaled from 800x480)
@@ -257,10 +256,11 @@ void DisplayDriverTFT::drawDashboard(const ScreenState& st) {
_tft.setCursor(dispW - wifiW - 10, 20);
_tft.print(wifiText);
// Get tile layouts from library helper
int tileCount = display.calculateDashboardLayouts(STYLE_HEADER_HEIGHT, STYLE_TILE_GAP);
display.setHeaderHeight(STYLE_HEADER_HEIGHT);
const TileLayout* layouts = display.getTileLayouts();
// Calculate tile layouts using TileLayoutHelper
TileLayout layouts[DASHBOARD_TILE_COUNT];
int gridCols, gridRows;
int tileCount = TileLayoutHelper::calculateLayouts(
dispW, dispH, STYLE_HEADER_HEIGHT, STYLE_TILE_GAP, layouts, &gridCols, &gridRows);
const char* tileLabels[] = { "Alert", "Silent", "Status", "Reboot" };
const uint16_t tileColors[] = { 0x0280, 0x0400, 0x0440, 0x0100 };