refactor: add active parameter to updateHint method signature
1. **Method Signature Update**: Added `bool active` parameter to `updateHint()` method across the display driver hierarchy: - `DisplayManager::updateHint(x, y, active)` - delegates to driver - `DisplayDriverTFT::updateHint(x, y, active)` - override implementation - `DisplayDriverGFX::updateHint(x, y, active)` - override implementation 2. **Code Formatting**: `DisplayManager.h` reformatted (whitespace/comment style changes only) - **Breaking Change**: All existing `updateHint(x, y)` calls will fail to compile until updated to include the `active` parameter - **Enhanced Control**: Callers can now explicitly show/hide touch hints rather than just updating position, enabling better touch feedback UX (e.g., hide hint on touch release) - **API Consistency**: All implementations in the driver hierarchy now enforce the same signature
This commit is contained in:
@@ -13,7 +13,7 @@ public:
|
|||||||
TouchEvent readTouch() override;
|
TouchEvent readTouch() override;
|
||||||
int dashboardTouch(int x, int y) override;
|
int dashboardTouch(int x, int y) override;
|
||||||
HoldState updateHold(unsigned long holdMs) override;
|
HoldState updateHold(unsigned long holdMs) override;
|
||||||
void updateHint(int x, int y) override;
|
void updateHint(int x, int y, bool active) override;
|
||||||
int width() override { return DISPLAY_WIDTH; }
|
int width() override { return DISPLAY_WIDTH; }
|
||||||
int height() override { return DISPLAY_HEIGHT; }
|
int height() override { return DISPLAY_HEIGHT; }
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
TouchEvent readTouch() override;
|
TouchEvent readTouch() override;
|
||||||
int dashboardTouch(int x, int y) override;
|
int dashboardTouch(int x, int y) override;
|
||||||
HoldState updateHold(unsigned long holdMs) override;
|
HoldState updateHold(unsigned long holdMs) override;
|
||||||
void updateHint(int x, int y) override;
|
void updateHint(int x, int y, bool active) override;
|
||||||
|
|
||||||
int width() override;
|
int width() override;
|
||||||
int height() override;
|
int height() override;
|
||||||
|
|||||||
@@ -1,36 +1,40 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IDisplayDriver.h"
|
#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 {
|
class DisplayManager {
|
||||||
public:
|
public:
|
||||||
DisplayManager()
|
DisplayManager(IDisplayDriver* drv)
|
||||||
: _drv(nullptr) { }
|
|
||||||
explicit DisplayManager(IDisplayDriver* drv)
|
|
||||||
: _drv(drv) { }
|
: _drv(drv) { }
|
||||||
void setDriver(IDisplayDriver* drv) { _drv = drv; }
|
|
||||||
|
|
||||||
void begin() {
|
void begin() {
|
||||||
if(_drv)
|
if(_drv)
|
||||||
_drv->begin();
|
_drv->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBacklight(bool on) {
|
void setBacklight(bool on) {
|
||||||
if(_drv)
|
if(_drv)
|
||||||
_drv->setBacklight(on);
|
_drv->setBacklight(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void render(const ScreenState& st) {
|
void render(const ScreenState& st) {
|
||||||
if(_drv)
|
if(_drv)
|
||||||
_drv->render(st);
|
_drv->render(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchEvent readTouch() { return _drv ? _drv->readTouch() : TouchEvent {}; }
|
TouchEvent readTouch() { return _drv ? _drv->readTouch() : TouchEvent {}; }
|
||||||
|
|
||||||
int dashboardTouch(int x, int y) { return _drv ? _drv->dashboardTouch(x, y) : -1; }
|
int dashboardTouch(int x, int y) { return _drv ? _drv->dashboardTouch(x, y) : -1; }
|
||||||
|
|
||||||
HoldState updateHold(unsigned long ms) { return _drv ? _drv->updateHold(ms) : HoldState {}; }
|
HoldState updateHold(unsigned long ms) { return _drv ? _drv->updateHold(ms) : HoldState {}; }
|
||||||
void updateHint(int x, int y) {
|
|
||||||
|
void updateHint(int x, int y, bool active) {
|
||||||
if(_drv)
|
if(_drv)
|
||||||
_drv->updateHint(x, y);
|
_drv->updateHint(x, y, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
int width() { return _drv ? _drv->width() : 0; }
|
int width() { return _drv ? _drv->width() : 0; }
|
||||||
|
|
||||||
int height() { return _drv ? _drv->height() : 0; }
|
int height() { return _drv ? _drv->height() : 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user