aboutsummaryrefslogtreecommitdiff
path: root/redbutton.go
diff options
context:
space:
mode:
Diffstat (limited to 'redbutton.go')
-rw-r--r--redbutton.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/redbutton.go b/redbutton.go
index d31864e..4ee3885 100644
--- a/redbutton.go
+++ b/redbutton.go
@@ -44,7 +44,7 @@ func Poll(dev *hid.Device, d time.Duration) <-chan Event {
}
ch := make(chan Event)
go func() {
- prev := Unknown
+ prev := LidClosed
tick := time.NewTicker(d)
defer tick.Stop()
defer close(ch)
@@ -53,10 +53,10 @@ func Poll(dev *hid.Device, d time.Duration) <-chan Event {
if err != nil {
return
}
- if state != prev {
+ if state != prev && prev != ButtonPressed {
ch <- state
- prev = state
}
+ prev = state
}
}()
return ch