summaryrefslogtreecommitdiff
path: root/util/spkmodem_recv
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-06-04 15:10:35 +0100
committerLeah Rowe <leah@libreboot.org>2023-06-04 15:10:35 +0100
commit979db74ca5768f6757a82ac2654e40caf183a66b (patch)
tree9cbce17599ebc043e159df1686dd1ffa0749c70b /util/spkmodem_recv
parent94aa43d85750c676450e7ae0e29c06c861a126f8 (diff)
util/spkmodem-recv: simplify pulse check
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/spkmodem_recv')
-rw-r--r--util/spkmodem_recv/spkmodem-recv.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c
index d13d8c7d..1dcf5f18 100644
--- a/util/spkmodem_recv/spkmodem-recv.c
+++ b/util/spkmodem_recv/spkmodem-recv.c
@@ -98,16 +98,11 @@ fetch_sample(void)
!= sizeof(frame[0]))
err(errno = ECANCELED, "Could not read frame.");
- if (abs(frame[ringpos]) > THRESHOLD) { /* rising/falling edge(pulse) */
- pulse[ringpos] = 1;
- f2++;
- } else {
- pulse[ringpos] = 0;
- }
-
- ringpos++;
+ pulse[ringpos] = (abs(frame[ringpos]) > THRESHOLD) ? 1 : 0;
+ if (pulse[ringpos++])
+ ++f2;
ringpos %= 2 * SAMPLES_PER_FRAME;
- lp++;
+ ++lp;
}
void