From 74717609ec29b4bcfe45850b8d1ccc0a62dc3de1 Mon Sep 17 00:00:00 2001 From: bel Date: Sun, 26 Mar 2023 10:00:10 -0600 Subject: [PATCH] v01.yaml has .quiet=true to cause all button pushes to become releases --- host.d/config.d/mayhem-party.d/v01.yaml | 1 + src/device/input/parse/v01/config.go | 1 + src/device/input/parse/v01/testdata/v01.yaml | 1 + src/device/input/parse/v01/v01.go | 8 +++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/host.d/config.d/mayhem-party.d/v01.yaml b/host.d/config.d/mayhem-party.d/v01.yaml index 9f3ab7d..da2363d 100644 --- a/host.d/config.d/mayhem-party.d/v01.yaml +++ b/host.d/config.d/mayhem-party.d/v01.yaml @@ -20,3 +20,4 @@ players: 2: 6 3: 7 4: 8 +quiet: false diff --git a/src/device/input/parse/v01/config.go b/src/device/input/parse/v01/config.go index ee0105a..8ef4294 100644 --- a/src/device/input/parse/v01/config.go +++ b/src/device/input/parse/v01/config.go @@ -12,4 +12,5 @@ type config struct { Players []struct { Transformation transformation } + Quiet bool } diff --git a/src/device/input/parse/v01/testdata/v01.yaml b/src/device/input/parse/v01/testdata/v01.yaml index 7c1cca0..8758d99 100644 --- a/src/device/input/parse/v01/testdata/v01.yaml +++ b/src/device/input/parse/v01/testdata/v01.yaml @@ -17,3 +17,4 @@ players: b: "2" x: "3" y: "4" +quiet: false diff --git a/src/device/input/parse/v01/v01.go b/src/device/input/parse/v01/v01.go index 930383a..f42d5e9 100644 --- a/src/device/input/parse/v01/v01.go +++ b/src/device/input/parse/v01/v01.go @@ -60,7 +60,13 @@ func (v01 *V01) Read() []button.Button { } v01.telemetry(msg) - return v01.transform(msg).buttons() + buttons := v01.transform(msg).buttons() + if v01.cfg.Quiet { + for i := range buttons { + buttons[i].Down = false + } + } + return buttons } func (v01 *V01) telemetry(msg message) {