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

View File

@@ -0,0 +1,24 @@
#pragma once
#include "IDisplayDriver.h"
/// Owns a pointer to the concrete driver; all calls delegate.
/// Board sketch creates the concrete driver and passes it in.
class DisplayManager {
public:
DisplayManager() : _drv(nullptr) {}
explicit DisplayManager(IDisplayDriver* drv) : _drv(drv) {}
void setDriver(IDisplayDriver* drv) { _drv = drv; }
void begin() { if (_drv) _drv->begin(); }
void setBacklight(bool on) { if (_drv) _drv->setBacklight(on); }
void render(const ScreenState& st) { if (_drv) _drv->render(st); }
TouchEvent readTouch() { return _drv ? _drv->readTouch() : TouchEvent{}; }
int dashboardTouch(int x, int y) { return _drv ? _drv->dashboardTouch(x, y) : -1; }
HoldState updateHold(unsigned long ms) { return _drv ? _drv->updateHold(ms) : HoldState{}; }
void updateHint() { if (_drv) _drv->updateHint(); }
int width() { return _drv ? _drv->width() : 0; }
int height() { return _drv ? _drv->height() : 0; }
private:
IDisplayDriver* _drv;
};