Skip to content

Commit

Permalink
nec: increase tolerances for bit pulses (#107)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sjoerdsimons authored Feb 8, 2024
1 parent e24477b commit b0cb9e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/protocol/nec/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const fn pulselens<Cmd: NecCommandVariant>() -> [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<Mono: InfraMonotonic, Cmd: NecCommandVariant> DecoderBuilder<Mono> for Nec<Cmd> {
type Decoder = NecDecoder<Mono, Cmd>;
Expand Down

0 comments on commit b0cb9e3

Please sign in to comment.