snapshot
This commit is contained in:
@@ -2,17 +2,13 @@
|
||||
#include <TFT_eSPI.h>
|
||||
#include "ScreenData.h"
|
||||
|
||||
// Grid layout constants
|
||||
#define DASH_COLS 3
|
||||
#define DASH_ROWS 2
|
||||
#define DASH_MARGIN 8
|
||||
#define DASH_TOP_BAR 40
|
||||
#define TILE_W ((480 - (DASH_COLS + 1) * DASH_MARGIN) / DASH_COLS)
|
||||
#define TILE_H ((320 - DASH_TOP_BAR - (DASH_ROWS + 1) * DASH_MARGIN) / DASH_ROWS)
|
||||
|
||||
// Tile dimensions (calculated for 480x320)
|
||||
#define TILE_W ((480 - (DASH_COLS + 1) * DASH_MARGIN) / DASH_COLS) // ~148
|
||||
#define TILE_H ((320 - DASH_TOP_BAR - (DASH_ROWS + 1) * DASH_MARGIN) / DASH_ROWS) // ~128
|
||||
|
||||
// Tile IDs
|
||||
enum TileID : uint8_t {
|
||||
TILE_LAST_ALERT = 0,
|
||||
TILE_STATS,
|
||||
@@ -37,13 +33,11 @@ class Dashboard {
|
||||
public:
|
||||
Dashboard(TFT_eSPI& tft);
|
||||
|
||||
void begin(); // create sprite (call once)
|
||||
void drawAll(); // fill screen + draw all tiles
|
||||
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); // returns TileID or -1
|
||||
|
||||
// Populate tiles from ScreenState — only redraws changed tiles
|
||||
int handleTouch(int x, int y);
|
||||
void refreshFromState(const ScreenState& state);
|
||||
|
||||
private:
|
||||
@@ -51,7 +45,6 @@ private:
|
||||
TFT_eSprite _sprite;
|
||||
TileData _tiles[TILE_COUNT];
|
||||
|
||||
// Cached top bar values for dirty check
|
||||
char _barTime[12] = "";
|
||||
int _barRSSI = 0;
|
||||
bool _barWifiOk = false;
|
||||
|
||||
Reference in New Issue
Block a user