From e23cecb496d8345d728bb8429b95a9aa564b9148 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 12 Mar 2026 05:28:34 +0000 Subject: 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 --- util/spkmodem_recv/spkmodem-recv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index 5992c20b..d448c84b 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -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; -- cgit v1.2.1