Skip to content

Fix: Correct comment for push() and add setSwitchDebounceDelay(int) #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
34 changes: 26 additions & 8 deletions src/SimpleRotary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ void SimpleRotary::setDebounceDelay(int i)
}


/**
SET SWITCH DEBOUNCE DELAY
Sets the debounce delay time for the encoder's switch in milliseconds.

This number shold be set as small as possible to maintain responsiveness while avoiding spurious activations.
Higher values can cause missed inputs, especially with fast or repeated presses.
Finding this value will vary from one rotary encoder to another and can be found simply with
trial and error.

You can turn this feature off by setting the delay value to 0.

@since v1.1.4;
**/
void SimpleRotary::setSwitchDebounceDelay(int i)
{
_debounceSDelay = i;
}


/**
SET ERROR CORRECTION DELAY
Sets the error correction delay delay time in milliseconds.
Expand Down Expand Up @@ -143,15 +162,14 @@ byte SimpleRotary::rotate()

/**
GET BUTTON PUSH
Gets the status of the pushbutton
Gets the status of the switch.

Returned values
0x00 = Not turned.
0x01 = Clockwise;
0x02 = Counter-Clockwise

@since v0.1;
@return byte, value of turned knob.
Returned values:
0x00 = Button not pressed.
0x01 = Button pressed.

@since v0.1
@return byte, status of the switch.
**/
byte SimpleRotary::push(){
_updateTime();
Expand Down
1 change: 1 addition & 0 deletions src/SimpleRotary.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SimpleRotary
byte pushType(int i);
void setTrigger(byte i);
void setDebounceDelay(int i);
void setSwitchDebounceDelay(int i);
void setErrorDelay(int i);
void resetPush();

Expand Down