diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-12 05:28:34 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-12 05:28:34 +0000 |
| commit | e23cecb496d8345d728bb8429b95a9aa564b9148 (patch) | |
| tree | fc04ad91795194d8804a995efd67ed01ab79a7ea /util/spkmodem_recv | |
| parent | 1d2ee1cabc29a1393f28ddce10674fdeada20d73 (diff) | |
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>
Diffstat (limited to 'util/spkmodem_recv')
| -rw-r--r-- | util/spkmodem_recv/spkmodem-recv.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; |
