37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "board_config.h"
|
|
|
|
#include <KlubhausCore.h>
|
|
#include <TFT_eSPI.h>
|
|
|
|
class DisplayDriverTFT : public IDisplayDriver {
|
|
public:
|
|
void begin() override;
|
|
void setBacklight(bool on) override;
|
|
void render(const ScreenState& state) override;
|
|
TouchEvent readTouch() override;
|
|
uint16_t getRawTouchZ();
|
|
HoldState updateHold(unsigned long holdMs) override;
|
|
void updateHint(int x, int y, bool active) override;
|
|
int width() override { return DISPLAY_WIDTH; }
|
|
int height() override { return DISPLAY_HEIGHT; }
|
|
|
|
// Dashboard tiles - library handles grid math, we just draw
|
|
void transformTouch(int* x, int* y) override;
|
|
void drawTileAt(int x, int y, int w, int h, const char* label, uint16_t bgColor) override;
|
|
|
|
private:
|
|
void drawBoot(const ScreenState& st);
|
|
void drawAlert(const ScreenState& st);
|
|
void drawDashboard(const ScreenState& st);
|
|
|
|
TFT_eSPI _tft;
|
|
|
|
bool _holdActive = false;
|
|
uint32_t _holdStartMs = 0;
|
|
ScreenID _lastScreen = ScreenID::BOOT;
|
|
BootStage _lastBootStage = BootStage::SPLASH;
|
|
bool _needsRedraw = true;
|
|
};
|