Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ It returns `true` if a push button was released (switched towards the off positi

### `longPress()`

It returns `true` if a push button is pressed longer than `300ms` (by default). Note that a `longPress()` always will be preceded by `pushed()` from the first push.
It returns `true` if a push button was pressed longer than `300ms` (by default). Note that a `longPress()` always will be preceded by `pushed()` from the first push.

### `isLongPressed()`

It returns `true` if the conditions for `longPress()` were true and the push button is still being held down.

### `doubleClick()`

Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on KEYWORD2
pushed KEYWORD2
released KEYWORD2
longPress KEYWORD2
isLongPressed KEYWORD2
doubleClick KEYWORD2
singleClick KEYWORD2
setPushedCallback KEYWORD2
Expand Down
4 changes: 3 additions & 1 deletion src/avdweb_Switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
********************************************************************************
......................................DOUBLE CLICK..............................

__________ ______
__________ ______
debounced ________| |_______| |_____________________________

poll ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
Expand Down Expand Up @@ -264,6 +264,8 @@ bool Switch::released() { return _switched && (debounced ^ polarity); }

bool Switch::longPress() { return _longPress; }

bool Switch::isLongPressed() { return longPressDisable; }

bool Switch::doubleClick() { return _doubleClick; }

bool Switch::singleClick() { return _singleClick; }
Expand Down
1 change: 1 addition & 0 deletions src/avdweb_Switch.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Switch {
bool pushed(); // will be refreshed by poll()
bool released(); // will be refreshed by poll()
bool longPress(); // will be refreshed by poll()
bool isLongPressed(); // will be refreshed by poll()
bool doubleClick(); // will be refreshed by poll()
bool singleClick(); // will be refreshed by poll()

Expand Down
Loading