makeybutton: use smaller buffer for faster response

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2022-07-27 21:11:05 +02:00
committed by Daniel Esteban
parent d0163c67f5
commit 1f54c7dd23
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
package makeybutton
const bufferSize = 10
const bufferSize = 6
// Buffer is a buffer to keep track of the most recent readings for a button.
type Buffer struct {
+1 -1
View File
@@ -61,7 +61,7 @@ func (b *Button) Get() ButtonEvent {
b.readings.Put(pressed)
switch {
case pressed && avg > 0:
case pressed && avg > -1 * bufferSize - 2:
if b.state == Press {
return NotChanged
}