Skip to content

Commit

Permalink
Repeated debounce removed
Browse files Browse the repository at this point in the history
  • Loading branch information
DoImant committed Dec 6, 2023
1 parent 080c5f9 commit 713621a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Button_SL",
"version": "1.1.3",
"version": "1.1.4",
"keywords": "button, debounce, signal, input, ouput",
"description": "Button_SL enables the query of buttons. The query is debounced. A query can be made as to whether the button was pressed for a short or long time.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Button_SL
version=1.1.3
version=1.1.4
author=Kai R.
maintainer=Kai R.
sentence=Button query
Expand Down
9 changes: 6 additions & 3 deletions src/Button_SL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/// @version 1.1.0 The ButtonSL class can now provide a status after the specified time period
/// for a long button press, even if the button remains permanently pressed.
///
/// @date 2023-12-06
/// @version 1.1.4 Repeated debounce in the button class removed.
///
/// @copyright Copyright (c) 2022
/// MIT license, check license.md for more information
/// All text above must be included in any redistribution
Expand Down Expand Up @@ -54,12 +57,12 @@ bool Button::tick() {
[[fallthrough]];
case HIGH:
if (millis() - timeStamp > dbTime_ms) {
compareState = LOW; // If the button press is equal to the specified debounce time,
flag = true; // confirm the button press with true.
// If the button press is equal to the specified debounce time, confirm the button press with true.
flag = true;
}
break;
}
} else if (compareState) {
} else if (compareState == true) {
compareState = LOW; // set to LOW if button is no longer pressed
}
return flag;
Expand Down

0 comments on commit 713621a

Please sign in to comment.