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

gpio-buttons - activate debouncing #190

Open
albatrosos opened this issue Feb 28, 2023 · 2 comments
Open

gpio-buttons - activate debouncing #190

albatrosos opened this issue Feb 28, 2023 · 2 comments

Comments

@albatrosos
Copy link

Hello,

using the gpio-buttons plugin without a hardware debouncing of the input pins, at least in my case, often leads to bouncing effects (e.g. pressing play/stop one time leads to a stop and direct restart). While this is no problem for a shutdown button or maybe even a volume +/- button, it can be quite annoying on a play/stop button.

As far as I found out, the used onoff library for the Gpio reading already provides a software debounce, which works flawlessly for me.
Wouldn't it be meaningful to generally activate this debouncing in gpio-buttons or maybe make it configurable?

I just had to change this line of code in index.js of gpio-buttons:
currently:
var j = new Gpio(pin,'in','both');
modified:
var j = new Gpio(pin,'in','both', {debounceTimeout: 50});

I chose 50ms as debounce value, since I don't think a quicker reaction is necessary, but probably this value could also be reduced to 10-20ms, if desired.

@albatrosos
Copy link
Author

Since I am new to GitHub, please tell me, if this location is wrong for this request or if an issue is the wrong way to ask for this modification. :)

@Korniman-the-Rooky
Copy link

Korniman-the-Rooky commented Mar 21, 2023

@Darmur

Since I am new to GitHub, please tell me, if this location is wrong for this request or if an issue is the wrong way to ask for this modification. :)

Hi I have faced the same issue, sometimes the play pause button works well sometimes it bounces. - not often but it happen, I like your idea to activate the debounce, then I would save a piece of hardware in my player

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