Compare commits

...

3 Commits

Author SHA1 Message Date
sctanf
6de7f0d418 spotless.. 2026-02-26 14:11:53 -06:00
sctanf
ffe05cfe77 Do nothing if action is 0/depress 2026-02-26 14:00:39 -06:00
sctanf
6979d56796 HIDCommon use button as tap 2026-02-26 13:56:16 -06:00

View File

@@ -291,13 +291,22 @@ class HIDCommon {
}
}
if (button != null) {
// TODO: May support multiple buttons in the future? For now, mask first 2 bits
// Tracker sends button state once button has been released and double press/hold timeout elapsed
// The received state represents the action to be performed, only if it has changed
if (tracker.button == null) {
tracker.button = 0
}
if (button != tracker.button) {
button = button and tracker.button!!.inv()
// Nothing to do now..
val changed: Int = button and tracker.button!!.inv()
if (changed shr 0 and 3 != 0) {
// 0: reset, 1: single press, 2: double press, 3: N/A (held, not available on shared button)
// TODO: For now, just send a tap for any action
val action: Int = button shr 0 and 3
if (action != 0) {
VRServer.instance.tapSetupHandler.sendTap(tracker)
}
}
tracker.button = button
}
if (fw_date != null) {
val firmwareYear = 2020 + (fw_date shr 9 and 127)