AP_Compass: Add HMC5843 and second AK8963 autodetection to BBBmini

This commit is contained in:
mirkix 2016-04-24 10:23:47 +02:00 committed by Lucas De Marchi
parent 2aba5a4643
commit 3df5a02448
1 changed files with 24 additions and 0 deletions

View File

@ -453,6 +453,30 @@ void Compass::_detect_backends(void)
}
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_QFLIGHT
_add_backend(AP_Compass_QFLIGHT::detect(*this));
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_BBBMINI
AP_Compass_Backend *backend = AP_Compass_HMC5843::probe(*this, hal.i2c_mgr->get_device(HAL_COMPASS_HMC5843_I2C_BUS, HAL_COMPASS_HMC5843_I2C_ADDR));
if (backend) {
_add_backend(backend);
hal.console->printf("HMC5843: External compass detected\n");
} else {
hal.console->printf("HMC5843: External compass not detected\n");
}
backend = AP_Compass_AK8963::probe_mpu9250(*this, 0);
if (backend) {
_add_backend(backend);
hal.console->printf("AK8953: Onboard compass detected\n");
} else {
hal.console->printf("AK8953: Onboard compass not detected\n");
}
backend = AP_Compass_AK8963::probe_mpu9250(*this, 1);
if (backend) {
_add_backend(backend);
hal.console->printf("AK8953: External compass detected\n");
} else {
hal.console->printf("AK8953: External compass not detected\n");
}
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_AK8963_MPU9250
_add_backend(AP_Compass_AK8963::probe_mpu9250(*this, 0));
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_HMC5843