Made the timeout for lis2dw_read_fifo a variable

This commit is contained in:
David Volovskiy
2025-10-07 08:07:02 -04:00
committed by Alessandro Genova
parent c6c97556ac
commit 19f789e428
4 changed files with 8 additions and 7 deletions
@@ -448,13 +448,13 @@ static void start_reading(accelerometer_data_acquisition_state_t *state) {
state->records[state->pos++] = record;
lis2dw_fifo_t fifo;
lis2dw_read_fifo(&fifo); // dump the fifo, this starts a fresh round of data in continue_reading
lis2dw_read_fifo(&fifo, 100); // dump the fifo, this starts a fresh round of data in continue_reading
}
static void continue_reading(accelerometer_data_acquisition_state_t *state) {
printf("Continue reading\n");
lis2dw_fifo_t fifo;
lis2dw_read_fifo(&fifo);
lis2dw_read_fifo(&fifo, 100);
fifo.count = min(fifo.count, 25); // hacky, but we need a consistent data rate; if we got a 26th data point, chuck it.
uint8_t offset = 4 * (25 - fifo.count); // also hacky: we're sometimes short at the start. align to beginning of next second.