util/spkmodem-recv: clearer pulse decoding

i turned this into abs() call earlier, but this isn't
obviously readable by some people.

make it absolutely clear what this does. also reduces
use of syscalls.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 05:28:34 +00:00
parent 1d2ee1cabc
commit e23cecb496
+6 -1
View File
@@ -174,7 +174,12 @@ decode_pulse(struct decoder_state *st)
st->frame[st->ringpos] = read_sample(st);
new_pulse = abs(st->frame[st->ringpos]) > THRESHOLD;
if (st->frame[st->ringpos] > THRESHOLD ||
st->frame[st->ringpos] < -THRESHOLD)
new_pulse = 1;
else
new_pulse = 0;
st->pulse[st->ringpos] = new_pulse;
st->freq_separator += new_pulse;