Amend long press behaviour

This commit is contained in:
jpirnay
2026-04-30 11:08:42 +02:00
parent 0366f8ece8
commit da7ad888c7
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -86,6 +86,10 @@ void ButtonEventManager::processButton(const int idx, const Button btn) {
pushEvent(btn, PressType::Short);
s.state = State::Idle;
}
} else if (held && now - s.pressDownTime >= LONG_PRESS_MS) {
// Fire long press immediately once the threshold is reached.
pushEvent(btn, PressType::Long);
s.state = State::Idle;
} else if (!held) {
// Button disappeared without wasReleased edge (e.g. after drain) — reset
s.state = State::Idle;
+1 -1
View File
@@ -16,7 +16,7 @@ ButtonEventManager& globalButtonEvents();
// on release (zero extra wait).
// - If a double-click action IS configured, Short is delayed by DOUBLE_WINDOW_MS
// to allow disambiguation.
// - Long fires on release once hold time >= LONG_PRESS_MS (no extra wait).
// - Long fires as soon as hold time >= LONG_PRESS_MS; release is not required.
// - Double fires on the second release within DOUBLE_WINDOW_MS.
//
// Activities query consumeEvent() each loop tick to receive pending events.