Skip to content

Commit 609450c

Browse files
Martin-LaclaustraMartin-Laclaustra
Martin-Laclaustra
authored and
Martin-Laclaustra
committed
Bugfix. Initialize time variables in the constructor. Fixes issue #8
1 parent c1d9ab6 commit 609450c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

avdweb_Switch.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ WEBSITE: http://www.avdweb.nl/arduino/hardware-interfacing/simple-switch-debounc
1616
1.0.3 15-01-2016 added deglitching
1717
1.0.5 25-01-2017 file renamed to avdweb_Switch
1818
1.1.0 28-07-2018 added callbacks (code by Sean Lanigan, added by Martin Laclaustra)
19-
1.2.0-rc 28-07-2017 added singleclick. Reorganize, keeping variables for each event in one function
19+
1.2.0-rc 28-07-2018 added singleclick. Reorganize, keeping variables for each event in one function
20+
1.2.0 29-09-2018 released
21+
1.2.1 30-11-2018 bugfix. Initialize time variables in the constructor. Fixes false event if first call to poll was delayed
2022
2123
..........................................DEGLITCHING..............................
2224
@@ -114,6 +116,7 @@ pin(_pin), polarity(polarity), deglitchPeriod(deglitchPeriod), debouncePeriod(de
114116
switchedTime = millis();
115117
debounced = digitalRead(pin);
116118
singleClickDisable = true;
119+
poll();
117120
}
118121

119122
bool Switch::poll()

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Switch
2-
version=1.2.0
2+
version=1.2.1
33
author=Albert van Dalen
44
maintainer=Albert van Dalen <[email protected]>
55
sentence=Arduino library for deglitching and debouncing switches and buttons.

0 commit comments

Comments
 (0)