]> git.earman.xyz Git - sensor-watch.git/commitdiff
bugfix: maintain accelerometer background sampling rate after wake from sleep
authorJoey Castillo <joeycastillo@utexas.edu>
Thu, 3 Jul 2025 21:14:08 +0000 (17:14 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Thu, 3 Jul 2025 21:14:08 +0000 (17:14 -0400)
movement.c

index 33eb231fb94f44600091eb8976bf24fa5b6bf842..46ca4179c7dee17f8906b6d2c9ef80062d0e817d 100644 (file)
@@ -784,11 +784,12 @@ void app_setup(void) {
             // Enable the interrupts...
             lis2dw_enable_interrupts();
 
-            // ...and power down the accelerometer to save energy. This means the interrupts we just configured won't fire.
+            // At first boot, this next line sets the accelerometer's sampling rate to 0, which is LIS2DW_DATA_RATE_POWERDOWN.
+            // This means the interrupts we just configured won't fire.
             // Tap detection will ramp up sesing and make use of the A3 interrupt.
-            // If a watch face wants to check in on the A4 pin, it can call movement_set_accelerometer_background_rate
-            lis2dw_set_data_rate(LIS2DW_DATA_RATE_POWERDOWN);
-            movement_state.accelerometer_background_rate = LIS2DW_DATA_RATE_POWERDOWN;
+            // If a watch face wants to check in on the A4 interrupt pin for motion status, it can call
+            // movement_set_accelerometer_background_rate with another rate like LIS2DW_DATA_RATE_LOWEST or LIS2DW_DATA_RATE_25_HZ.
+            lis2dw_set_data_rate(movement_state.accelerometer_background_rate);
         }
 #endif