mirror of
https://github.com/joeycastillo/second-movement.git
synced 2025-10-29 19:47:40 +00:00
accelerometer: don't initialize on wake if already set up
This commit is contained in:
parent
bb5aa4ff7c
commit
1a5ccd34a0
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user