]> git.earman.xyz Git - sensor-watch.git/commitdiff
defined LIS2DW_FIFO_TIMEOUT_SECOND
authorDavid Volovskiy <devolov@gmail.com>
Wed, 8 Oct 2025 21:48:34 +0000 (17:48 -0400)
committerAlessandro Genova <ales.genova@gmail.com>
Sat, 3 Jan 2026 01:07:56 +0000 (20:07 -0500)
legacy/watch_faces/sensor/accelerometer_data_acquisition_face.c
watch-faces/sensor/lis2dw_monitor_face.c
watch-library/shared/driver/lis2dw.h

index 64a25a871d17492f6be45fc4a0ce5443d58435bc..968a7b81b45215ea14b605747055446326cd4fd9 100644 (file)
@@ -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, 100); // dump the fifo, this starts a fresh round of data in continue_reading
+    lis2dw_read_fifo(&fifo, LIS2DW_FIFO_TIMEOUT_SECOND); // 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, 100);
+    lis2dw_read_fifo(&fifo, LIS2DW_FIFO_TIMEOUT_SECOND);
 
     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.
index 46cc15f32eba90603d2ae438da1893c2521c135b..ade0df550f47d2e38651d875c676b9ea904ffa81 100644 (file)
@@ -420,7 +420,7 @@ static void _monitor_update(lis2dw_monitor_state_t *state)
     lis2dw_fifo_t fifo;
     float x = 0, y = 0, z = 0;
 
-    lis2dw_read_fifo(&fifo, 100 / DISPLAY_FREQUENCY);
+    lis2dw_read_fifo(&fifo, LIS2DW_FIFO_TIMEOUT_SECOND / DISPLAY_FREQUENCY);
     if (fifo.count == 0) {
         return;
     }
index d3a09dc4a2621aea2c534c988dc2a2bc67335e60..f81c7750edbed3fe707b7b2c2044e6146e570496 100644 (file)
@@ -301,6 +301,8 @@ typedef enum {
 #define LIS2DW_CTRL7_VAL_HP_REF_MODE        0b00000010
 #define LIS2DW_CTRL7_VAL_LPASS_ON6D         0b00000001
 
+#define LIS2DW_FIFO_TIMEOUT_SECOND          100
+
 bool lis2dw_begin(void);
 
 uint8_t lis2dw_get_device_id(void);