From b0cb9e341c862b2f60286e938c6d6dda308ce790 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Thu, 8 Feb 2024 20:54:56 +0100 Subject: [PATCH] nec: increase tolerances for bit pulses (#107) The default 5% tolerance on the low bit pulses only ends up with a 56us slack. With the combination of a sloppy/cheap remote and a micro running at a low frequency (attiny @ 1hmz) it's quite easy to not recognize a pulse. Looking at the implementation in linux, that uses a margin of half a unit (560us), while also tracking both the low and high pulses. Up the tolerances to be roughly half a unit, which makes the recognition of signals much more reliable. --- src/protocol/nec/decoder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/nec/decoder.rs b/src/protocol/nec/decoder.rs index ff8be4a..6bf3bf5 100644 --- a/src/protocol/nec/decoder.rs +++ b/src/protocol/nec/decoder.rs @@ -24,7 +24,7 @@ const fn pulselens() -> [u32; 8] { ] } -const TOL: [u32; 8] = [7, 7, 5, 5, 0, 0, 0, 0]; +const TOL: [u32; 8] = [7, 7, 25, 12, 0, 0, 0, 0]; impl DecoderBuilder for Nec { type Decoder = NecDecoder;