accelerometer: don't initialize on wake if already set up

This commit is contained in:
Joey Castillo 2025-06-11 23:25:08 -04:00
parent bb5aa4ff7c
commit 1a5ccd34a0

View File

@ -716,6 +716,8 @@ void app_setup(void) {
watch_register_interrupt_callback(HAL_GPIO_BTN_ALARM_pin(), cb_alarm_btn_interrupt, INTERRUPT_TRIGGER_BOTH);
#ifdef I2C_SERCOM
// if accelerometer was already detected and set up, no need to set it up again.
if (!movement_state.has_lis2dw) {
watch_enable_i2c();
if (lis2dw_begin()) {
movement_state.has_lis2dw = true;
@ -761,6 +763,7 @@ void app_setup(void) {
} else {
watch_disable_i2c();
}
}
#endif
watch_enable_buzzer();