50 lines
1.3 KiB
C++
50 lines
1.3 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;
|
|
int dashboardTouch(int x, int y);
|
|
HoldState updateHold(unsigned long holdMs) override;
|
|
int width() override { return DISPLAY_WIDTH; }
|
|
int height() override { return DISPLAY_HEIGHT; }
|
|
|
|
// Fonts
|
|
void setTitleFont() override;
|
|
void setBodyFont() override;
|
|
void setLabelFont() override;
|
|
void setDefaultFont() override;
|
|
|
|
// Debug
|
|
void drawDebugTouch(int x, int y) 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;
|
|
|
|
// Touch tracking for press/release detection
|
|
bool _touchWasPressed = false;
|
|
int _touchDownX = -1;
|
|
int _touchDownY = -1;
|
|
|
|
// Test mode for touch injection
|
|
bool _testMode = false;
|
|
bool parseTestTouch(int* outX, int* outY, bool* outPressed);
|
|
};
|