Skip to content

Commit 30c2df1

Browse files
authored
use read_started_ms
This measures from when this `read()` call started, rather than when the last one ended.
1 parent be45c44 commit 30c2df1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/EasyButton.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool EasyButton::read() {
131131
_held_callback_called = false;
132132
}
133133
// button is not released.
134-
else if (_current_state && _time - _last_change >= _held_threshold && mPressedForCallback) {
134+
else if (_current_state && read_started_ms - _last_change >= _held_threshold && mPressedForCallback) {
135135
// button has been pressed for at least the given time
136136
_was_btn_held = true;
137137
// reset short presses counters.
@@ -147,4 +147,4 @@ bool EasyButton::read() {
147147
_time = read_started_ms;
148148

149149
return _current_state;
150-
}
150+
}

0 commit comments

Comments
 (0)