refactor(display): extract dashboard tile grid logic to DisplayManager

This commit is contained in:
2026-02-18 04:28:35 -08:00
parent 3b8e54c511
commit 67613120ad
10 changed files with 259 additions and 64 deletions

View File

@@ -7,6 +7,31 @@ enum class ScreenID { BOOT, OFF, ALERT, DASHBOARD };
enum class BootStage { SPLASH, INIT_DISPLAY, INIT_NETWORK, CONNECTING_WIFI, READY, DONE };
/// Dashboard tile action handlers
enum class TileAction {
NONE,
ALERT, // Trigger alert
SILENCE, // Silence alert
STATUS, // Send heartbeat/status
REBOOT, // Reboot device
};
/// Dashboard tile definitions — shared across all boards
struct DashboardTile {
const char* label;
uint16_t bgColor; // RGB565
TileAction action;
};
/// Standard dashboard tiles (auto-gridded based on count)
static constexpr DashboardTile DASHBOARD_TILES[] = {
{ "Alert", 0x0280, TileAction::ALERT },
{ "Silent", 0x0400, TileAction::SILENCE },
{ "Status", 0x0440, TileAction::STATUS },
{ "Reboot", 0x0100, TileAction::REBOOT },
};
static constexpr int DASHBOARD_TILE_COUNT = sizeof(DASHBOARD_TILES) / sizeof(DASHBOARD_TILES[0]);
struct ScreenState {
DeviceState deviceState = DeviceState::BOOTED;
ScreenID screen = ScreenID::BOOT;