util/spkmodem-recv: simplify pulse check

Signed-off-by: Leah Rowe <leah@libreboot.org>
fsdg20230625
Leah Rowe 2023-06-04 15:10:35 +01:00
parent 94aa43d857
commit 979db74ca5
1 changed files with 4 additions and 9 deletions

View File

@ -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