Closed jfatula closed 5 years ago
Current debounce time in exactly 0.08 seconds: https://github.com/google/aiyprojects-raspbian/blob/93a6306438492464c25916b6b2f53d8e4750579b/src/aiy/_drivers/_button.py#L28
You can change it and see how everything works after.
I'm currently using a VoiceKit V1 on a Pi3B with the latest AIY image. While working on double-click logic for an assistant script, I noticed that when using
my callback function was quite often being called more often than the button was pressed. Looking at the time between callbacks, a typical pattern was like this:
Pressing the button 15 times at 1-1.5 second intervals led to 21 callbacks, 6 of which followed the previous one by about 81 milliseconds.
Clearly my kit came with a very bouncy button, since the debounce_time limit in /aiy/_drivers/_button.py is set to 80 milliseconds. I don't know how common a problem this is, and I've worked around it by writing my own button driver, since I don't like to modify released code. If it's at all widespread, one might consider relaxing the default limit in _button.py or adding a keyword parameter to get_button() to allow it to be set from the high-level API. -jon