From e1b285782d61b78e09f9185376cec5b43ef03e79 Mon Sep 17 00:00:00 2001 From: beerpsi Date: Tue, 16 Jan 2024 07:58:37 +0700 Subject: [PATCH] fix(tasoller_v1): swapped air bits --- src/backends/tasoller_v1.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/backends/tasoller_v1.rs b/src/backends/tasoller_v1.rs index 19021a5..586a85c 100644 --- a/src/backends/tasoller_v1.rs +++ b/src/backends/tasoller_v1.rs @@ -19,12 +19,12 @@ //! - Bits 0..26: ??? //! - Bit 26: FN2 (1 = pressed) //! - Bit 27: FN1 (1 = pressed) -//! - Bit 28: IR2 -//! - Bit 29: IR1 -//! - Bit 30: IR4 -//! - Bit 31: IR3 -//! - Bit 32: IR6 -//! - Bit 33: IR5 +//! - Bit 28: IR1 +//! - Bit 29: IR2 +//! - Bit 30: IR3 +//! - Bit 31: IR4 +//! - Bit 32: IR5 +//! - Bit 33: IR6 //! - Bits 34..66: touch sensor 1-32 (1 = held, top -> bottom then left -> right) //! - Bits 66..88: ??? //! @@ -58,12 +58,8 @@ pub fn jvs_poll(input: &[u8]) -> (u8, u8) { let opbtn = input[3] >> 3 & 1 | input[3] >> 1 & 2; // IR1-6 in order - let beams = input[3] >> 5 & 1 - | input[3] >> 3 & 2 - | input[3] >> 5 & 4 - | input[3] >> 3 & 8 - | input[4] << 3 & 16 - | input[4] << 5 & 32; + let beams = input[3] >> 4 + | (input[4] & 3) << 4; (opbtn, beams) }