accelerometer: don't initialize on wake if already set up
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user