Skip to content
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

Pressed state is never handled #21

Open
martinmarcos opened this issue Oct 4, 2017 · 1 comment
Open

Pressed state is never handled #21

martinmarcos opened this issue Oct 4, 2017 · 1 comment

Comments

@martinmarcos
Copy link

Button states "Pressed" and "Close" are never used or handled. I interested in being able to detect when the button has been pressed and this state is never assigned. The reason I want to detect if the button has been pressed is to start ignoring knob movements. Now it happens that if you accidentally move the knob while pressing, when you release it you end up clicking on something unintended. It could be an optional new feature: click protection. Of course it wouldn't protect against knob movements before the button is pressed.

I tried to modify the code myself but I don't fully understand the state machine logic implemented. By the way, what would be the use of the "Close" state?

Regards.

@soligen2010
Copy link

I think Held and Released are the closest thing to what you want, There is just a delay until held kicks in so that held/released is not confused with a click or double click. If you use my fork of this lib it has methods to adjust the timing so can adjust the wait time for held and see if that works for you.

However I think an easier implementation would be to save the millis() for each knob change, then have your code ignore clicks if they are within a certain number of millis of the last knob value change. This way there is no need to track presses and releases. Or vice-versa. Save the change in knob value and don't "confirm" the change until enough time passes without a click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants