Long-press trackball blanks screen; suppress touch wakes when off

Two pocket-carry quality-of-life additions:

1. Long-press (1.2s) trackball click blanks the screen if no LVGL
   screen consumes the long-press. InputManager captures the power
   state at click DOWN (_clickFromScreenOn) and only emits the
   long-press if the screen was already on, so a long-press from
   SCREEN_OFF wakes without immediately re-blanking.

2. Touch events are ignored entirely while screen is off, preventing
   accidental wakes from pressure on the panel in a pocket/bag.
   Trackball click and keyboard keys still wake normally.

InputManager now holds a Power* injected via setPowerMgr() in setup.
This commit is contained in:
drkhsh
2026-04-26 02:50:54 +02:00
parent a8da0d8918
commit ef5d8ea189
3 changed files with 20 additions and 6 deletions
+5 -2
View File
@@ -435,6 +435,7 @@ void setup() {
// Step 10: Input manager
inputManager.begin(&keyboard, &trackball, &touch);
inputManager.setPowerMgr(&powerMgr);
// Step 10.5: LVGL input drivers
LvInput::init(&keyboard, &trackball, &touch);
@@ -933,9 +934,11 @@ void loop() {
powerMgr.weakActivity(); // Trackball: wake from dim only
}
// 2. Long-press dispatch
// 2. Long-press dispatch — screen blanking is the default if no screen consumes it
if (inputManager.hadLongPress()) {
ui.handleLongPress();
if (!ui.handleLongPress()) {
powerMgr.forceScreenOff();
}
}
// 3. Key event dispatch