consolidate sketches

This commit is contained in:
2026-02-16 17:53:06 -08:00
parent 75c3f5706b
commit 838afaa36f
42 changed files with 5655 additions and 817 deletions

56
Dashboard.h Normal file
View File

@@ -0,0 +1,56 @@
#pragma once
#include "DisplayDriver.h"
#include "ScreenData.h"
#define DASH_COLS 3
#define DASH_ROWS 2
#define DASH_MARGIN 8
#define DASH_TOP_BAR 40
#define TILE_W ((SCREEN_WIDTH - (DASH_COLS + 1) * DASH_MARGIN) / DASH_COLS)
#define TILE_H ((SCREEN_HEIGHT - DASH_TOP_BAR - (DASH_ROWS + 1) * DASH_MARGIN) / DASH_ROWS)
enum TileID : uint8_t {
TILE_LAST_ALERT = 0,
TILE_STATS,
TILE_NETWORK,
TILE_MUTE,
TILE_HISTORY,
TILE_SYSTEM,
TILE_COUNT
};
struct TileData {
const char* icon;
const char* label;
char value[32];
char sub[32];
uint16_t bgColor;
uint16_t fgColor;
bool dirty;
};
class Dashboard {
public:
Dashboard(Gfx& tft);
void begin();
void drawAll();
void drawTopBar(const char* time, int rssi, bool wifiOk);
void updateTile(TileID id, const char* value, const char* sub = nullptr);
int handleTouch(int x, int y);
void refreshFromState(const ScreenState& state);
private:
Gfx& _tft;
GfxSprite _sprite;
TileData _tiles[TILE_COUNT];
char _barTime[12] = "";
int _barRSSI = 0;
bool _barWifiOk = false;
void drawTile(TileID id);
void tilePosition(TileID id, int& x, int& y);
};