add select block to button press channel

- outchan is unbuffered, so drop the message if there's already one sitting there.
This commit is contained in:
Drew Bowering 2024-04-02 16:53:35 -06:00
parent 67607347e4
commit 772ac6a8d8
Signed by: drew
GPG Key ID: DC9462335BDDAC6B

View File

@ -211,7 +211,10 @@ func delayChan(inchan <-chan bool, outchan chan<- bool) {
now := time.Now() now := time.Now()
if now.Sub(last) > pressdelay { if now.Sub(last) > pressdelay {
last = now last = now
outchan <- val select {
case outchan <- val:
default:
}
} }
} }
} }