mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Fix flipped logic after move to Throttle::isWithinTimespanMs (#5221)
This commit is contained in:
parent
2d4d36c605
commit
ba2f25293b
@ -59,7 +59,7 @@ int32_t ScanAndSelectInput::runOnce()
|
|||||||
// If: "no messages added" alert screen currently shown
|
// If: "no messages added" alert screen currently shown
|
||||||
if (alertingNoMessage) {
|
if (alertingNoMessage) {
|
||||||
// Dismiss the alert screen several seconds after it appears
|
// Dismiss the alert screen several seconds after it appears
|
||||||
if (now > alertingSinceMs + durationAlertMs) {
|
if (!Throttle::isWithinTimespanMs(alertingSinceMs, durationAlertMs)) {
|
||||||
alertingNoMessage = false;
|
alertingNoMessage = false;
|
||||||
screen->endAlert();
|
screen->endAlert();
|
||||||
}
|
}
|
||||||
@ -74,9 +74,9 @@ int32_t ScanAndSelectInput::runOnce()
|
|||||||
|
|
||||||
// Existing press
|
// Existing press
|
||||||
else {
|
else {
|
||||||
// Duration enough for long press
|
// Longer than shortpress window
|
||||||
// Long press not yet fired (prevent repeat firing while held)
|
// Long press not yet fired (prevent repeat firing while held)
|
||||||
if (!longPressFired && Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) {
|
if (!longPressFired && !Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) {
|
||||||
longPressFired = true;
|
longPressFired = true;
|
||||||
longPress();
|
longPress();
|
||||||
}
|
}
|
||||||
@ -91,7 +91,9 @@ int32_t ScanAndSelectInput::runOnce()
|
|||||||
// Button newly released
|
// Button newly released
|
||||||
// Long press event didn't already fire
|
// Long press event didn't already fire
|
||||||
if (held && !longPressFired) {
|
if (held && !longPressFired) {
|
||||||
// Duration enough for short press
|
// Duration within shortpress window
|
||||||
|
// - longer than durationShortPress (debounce)
|
||||||
|
// - shorter than durationLongPress
|
||||||
if (!Throttle::isWithinTimespanMs(downSinceMs, durationShortMs)) {
|
if (!Throttle::isWithinTimespanMs(downSinceMs, durationShortMs)) {
|
||||||
shortPress();
|
shortPress();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user