bk1285 / rpi_wordclock

Software to create a Raspberry Pi based wordclock
GNU General Public License v3.0
214 stars 107 forks source link

Feature Request: Debounce on buttons #191

Closed R0lleston closed 3 years ago

R0lleston commented 3 years ago

@bk1285 my project uses both physical buttons and the webapp. I've noticed that when going through the menu with the buttons: the following has been observed : 1) trying to select the menu item the clock jumps into and back out of the plugin 2) selecting doesnt always select first time.

A common programming feature when using physical buttons is a debounce, whereby we have small filter (delay) implemented when a button is pressed to prevent spurious activations due to the switches mechanism.

Not sure if this has been implemented, but if it has the delay might need increasing a bit

mrksngl commented 3 years ago

Actually, there is debouncing.

It's not implemented by the wordclock code itself, but by the GPIO library (some hardware is even able to do that on its own, so the library might just pass it to the kernel).

Long story short: https://github.com/bk1285/rpi_wordclock/blob/8347da70e6dfa6da182d0d32bfca681a320f4728/wordclock_interfaces/gpio_interface.py#L42

the bouncetime parameter (ms) in those 3 calls does the job. But yes, it should be configurable.

R0lleston commented 3 years ago

@mrksngl thanks for the headsup :)