summaryrefslogtreecommitdiff
path: root/util/spkmodem_recv
diff options
context:
space:
mode:
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