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 -5
View File
@@ -6,10 +6,10 @@
#include <Arduino.h>
#include <KlubhausCore.h>
#include <Style.h>
// ── Globals ──
static LGFX* _gfx = nullptr;
extern DisplayManager display;
// ── Forward declarations ──
static void initDisplay();
@@ -443,10 +443,11 @@ void DisplayDriverGFX::drawDashboard(const ScreenState& state) {
},
safeWifi.w);
// 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(
DISP_W, DISP_H, STYLE_HEADER_HEIGHT, STYLE_TILE_GAP, layouts, &gridCols, &gridRows);
const char* tileLabels[] = { "Alert", "Silent", "Status", "Reboot" };
const uint16_t tileColors[] = { 0x0280, 0x0400, 0x0440, 0x0100 };