Skip to content

Commit

Permalink
Bugfix. Initialize time variables in the constructor. Fixes issue #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Laclaustra authored and Martin-Laclaustra committed Nov 30, 2018
1 parent c1d9ab6 commit 609450c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion avdweb_Switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ WEBSITE: http://www.avdweb.nl/arduino/hardware-interfacing/simple-switch-debounc
1.0.3 15-01-2016 added deglitching
1.0.5 25-01-2017 file renamed to avdweb_Switch
1.1.0 28-07-2018 added callbacks (code by Sean Lanigan, added by Martin Laclaustra)
1.2.0-rc 28-07-2017 added singleclick. Reorganize, keeping variables for each event in one function
1.2.0-rc 28-07-2018 added singleclick. Reorganize, keeping variables for each event in one function
1.2.0 29-09-2018 released
1.2.1 30-11-2018 bugfix. Initialize time variables in the constructor. Fixes false event if first call to poll was delayed
..........................................DEGLITCHING..............................
Expand Down Expand Up @@ -114,6 +116,7 @@ pin(_pin), polarity(polarity), deglitchPeriod(deglitchPeriod), debouncePeriod(de
switchedTime = millis();
debounced = digitalRead(pin);
singleClickDisable = true;
poll();
}

bool Switch::poll()
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=Switch
version=1.2.0
version=1.2.1
author=Albert van Dalen
maintainer=Albert van Dalen <[email protected]>
sentence=Arduino library for deglitching and debouncing switches and buttons.
Expand Down

0 comments on commit 609450c

Please sign in to comment.