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
39 lines
977 B
C++
39 lines
977 B
C++
#pragma once
|
|
|
|
#include "IDisplayDriver.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
class DisplayDriverGFX : public IDisplayDriver {
|
|
public:
|
|
// ── IDisplayDriver ──
|
|
void begin() override;
|
|
void setBacklight(bool on) override;
|
|
void render(const ScreenState& state) override;
|
|
|
|
TouchEvent readTouch() override;
|
|
int dashboardTouch(int x, int y) override;
|
|
HoldState updateHold(unsigned long holdMs) override;
|
|
void updateHint(int x, int y, bool active) override;
|
|
|
|
int width() override;
|
|
int height() override;
|
|
|
|
// ── Internal ──
|
|
static DisplayDriverGFX& instance();
|
|
|
|
private:
|
|
// Helper rendering functions
|
|
void drawAlert(const ScreenState& state);
|
|
void drawDashboard(const ScreenState& state);
|
|
|
|
// Touch handling
|
|
TouchEvent _lastTouch = { false, 0, 0 };
|
|
unsigned long _pressStartMs = 0;
|
|
bool _isHolding = false;
|
|
|
|
// Screen tracking
|
|
ScreenID _lastScreen = ScreenID::BOOT;
|
|
bool _needsRedraw = true;
|
|
};
|