43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#pragma once
|
|
#include <TFT_eSPI.h>
|
|
#include "ScreenData.h"
|
|
|
|
class DisplayManager {
|
|
public:
|
|
void begin();
|
|
void render(const ScreenState& state);
|
|
void setBacklight(bool on);
|
|
TouchEvent readTouch();
|
|
|
|
private:
|
|
TFT_eSPI _tft;
|
|
ScreenID _lastScreen = ScreenID::BOOT_SPLASH;
|
|
bool _needsFullRedraw = true;
|
|
bool _lastBlink = false;
|
|
|
|
// Colors
|
|
static constexpr uint16_t COL_NEON_TEAL = 0x07D7;
|
|
static constexpr uint16_t COL_HOT_FUCHSIA = 0xF81F;
|
|
static constexpr uint16_t COL_WHITE = 0xFFDF;
|
|
static constexpr uint16_t COL_BLACK = 0x0000;
|
|
static constexpr uint16_t COL_MINT = 0x67F5;
|
|
static constexpr uint16_t COL_DARK_GRAY = 0x2104;
|
|
static constexpr uint16_t COL_GREEN = 0x07E0;
|
|
static constexpr uint16_t COL_RED = 0xF800;
|
|
static constexpr uint16_t COL_YELLOW = 0xFFE0;
|
|
|
|
// Screen renderers
|
|
void drawBootSplash(const ScreenState& s);
|
|
void drawWifiConnecting();
|
|
void drawWifiConnected(const ScreenState& s);
|
|
void drawWifiFailed();
|
|
void drawAlertScreen(const ScreenState& s);
|
|
void drawStatusScreen(const ScreenState& s);
|
|
|
|
// Helpers
|
|
void drawCentered(const char* txt, int y, int sz, uint16_t col);
|
|
void drawInfoLine(int x, int y, uint16_t col, const char* text);
|
|
void drawHeaderBar(uint16_t col, const char* label, const char* timeStr);
|
|
};
|
|
|