refactor(Format code): Improve readability and structure

This commit is contained in:
2026-02-18 17:57:54 -08:00
parent c81e23f7cd
commit e4609c6978
11 changed files with 120 additions and 136 deletions

View File

@@ -10,24 +10,24 @@ enum class BootStage { SPLASH, INIT_DISPLAY, INIT_NETWORK, CONNECTING_WIFI, READ
/// Dashboard tile action handlers
enum class TileAction {
NONE,
ALERT, // Trigger alert
SILENCE, // Silence alert
STATUS, // Send heartbeat/status
REBOOT, // Reboot device
ALERT, // Trigger alert
SILENCE, // Silence alert
STATUS, // Send heartbeat/status
REBOOT, // Reboot device
};
/// Dashboard tile layout constraints for flexible grid
struct TileConstraint {
uint8_t minCols = 1; // minimum columns this tile needs
uint8_t minRows = 1; // minimum rows this tile needs
uint8_t weight = 1; // priority for growing/shrinking (higher = more flexible)
uint8_t minCols = 1; // minimum columns this tile needs
uint8_t minRows = 1; // minimum rows this tile needs
uint8_t weight = 1; // priority for growing/shrinking (higher = more flexible)
};
/// Computed tile position in the grid
struct TileLayout {
int x, y; // pixel position
int w, h; // pixel size
int col, row; // grid position
int x, y; // pixel position
int w, h; // pixel size
int col, row; // grid position
int cols, rows; // grid span
};
@@ -41,10 +41,10 @@ struct DashboardTile {
/// Standard dashboard tiles (auto-gridded based on count and constraints)
static constexpr DashboardTile DASHBOARD_TILES[] = {
{ "Alert", 0x0280, TileAction::ALERT, {1, 1, 1} },
{ "Silent", 0x0400, TileAction::SILENCE, {1, 1, 1} },
{ "Status", 0x0440, TileAction::STATUS, {1, 1, 1} },
{ "Reboot", 0x0100, TileAction::REBOOT, {1, 1, 1} },
{ "Alert", 0x0280, TileAction::ALERT, { 1, 1, 1 } },
{ "Silent", 0x0400, TileAction::SILENCE, { 1, 1, 1 } },
{ "Status", 0x0440, TileAction::STATUS, { 1, 1, 1 } },
{ "Reboot", 0x0100, TileAction::REBOOT, { 1, 1, 1 } },
};
static constexpr int DASHBOARD_TILE_COUNT = sizeof(DASHBOARD_TILES) / sizeof(DASHBOARD_TILES[0]);