Skip to content

Commit

Permalink
Naze32: Attempt retry with alternate EXTI config on failed MPU init
Browse files Browse the repository at this point in the history
Should make Afromini Amaze work
  • Loading branch information
tracernz authored and mlyle committed Apr 28, 2016
1 parent 11042d5 commit 16db23a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions flight/targets/naze32/fw/pios_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ void PIOS_Board_Init(void) {

pios_mpu_dev_t mpu_dev = NULL;
int retval = PIOS_MPU_I2C_Init(&mpu_dev, pios_i2c_internal_id, &pios_mpu_cfg);
if (retval == -PIOS_MPU_ERROR_NOIRQ && mpu_pin == HWNAZE_MPU6050INTPIN_AUTO) {
// retry with alternate exti config, needed on afromini
pios_mpu_cfg.exti_cfg = (pios_mpu_cfg.exti_cfg == &pios_exti_mpu_cfg_v5) ? &pios_exti_mpu_cfg : &pios_exti_mpu_cfg_v5;
retval = PIOS_MPU_I2C_Init(&mpu_dev, pios_i2c_internal_id, &pios_mpu_cfg);
}
if (retval != 0)
PIOS_HAL_Panic(PIOS_LED_ALARM, PIOS_HAL_PANIC_IMU);

Expand Down

0 comments on commit 16db23a

Please sign in to comment.