From 3eac707635cc94dfd00afde85a7ea31b48a8c551 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 8 Oct 2019 15:20:39 +0800 Subject: [PATCH] fix glasgow sample decoding --- src/noptica.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/noptica.rs b/src/noptica.rs index ee20297..b1d9a27 100644 --- a/src/noptica.rs +++ b/src/noptica.rs @@ -114,8 +114,8 @@ pub fn sample(command: &str, mut callback: impl FnMut(u8, u8)) { let mut last_sample = 0; loop { reader.read_exact(&mut buffer).unwrap(); - for shift in [4u8, 0u8].iter() { - let sample = (buffer[0] >> shift) & 0x0f; + for shift in [2u8, 0u8].iter() { + let sample = (buffer[0] >> shift) & 0x03; let rising = sample & !last_sample; let falling = !sample & last_sample; callback(rising, falling);