Make detection winow for double clicks smaller

This commit is contained in:
jpirnay
2026-05-15 21:08:19 +02:00
parent 1a6ddc4eda
commit 577e7154dc
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -270,6 +270,12 @@ void ButtonNavigator::onListNav(const Buttons& buttons, const bool forward, int&
return;
}
const bool wasPressed = std::any_of(buttons.begin(), buttons.end(),
[](const MappedInputManager::Button b) { return mappedInput->wasPressed(b); });
if (wasPressed) {
lastPressMs = millis();
}
const bool wasReleased = std::any_of(buttons.begin(), buttons.end(),
[](const MappedInputManager::Button b) { return mappedInput->wasReleased(b); });
if (!wasReleased) return;
@@ -283,7 +289,6 @@ void ButtonNavigator::onListNav(const Buttons& buttons, const bool forward, int&
const uint32_t now = millis();
const bool isDouble = (now - lastPressMs) < listDoubleClickMs;
lastPressMs = now;
if (isDouble) {
// Restore to position before the first press so the total movement is exactly listJumpCount.
+1 -1
View File
@@ -22,7 +22,7 @@ class ButtonNavigator final {
bool longPressPreviousFired = false;
int indexBeforePress = 0;
static constexpr uint16_t listDoubleClickMs = 350;
static constexpr uint16_t listDoubleClickMs = 200;
static constexpr uint32_t listLongPressMs = 1500;
static constexpr int listJumpCount = 10;