From c3a6a56ebbb17a2a22618127f4aae4c821fec255 Mon Sep 17 00:00:00 2001 From: mirkix Date: Sun, 24 Apr 2016 10:24:37 +0200 Subject: [PATCH] AP_InertialSensor: Add second MPU9250 autodetection to BBBmini --- .../AP_InertialSensor/AP_InertialSensor.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index 1f8466b287..2ce4fda8be 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -555,6 +555,22 @@ AP_InertialSensor::detect_backends(void) _add_backend(AP_InertialSensor_QFLIGHT::detect(*this)); #elif HAL_INS_DEFAULT == HAL_INS_QURT _add_backend(AP_InertialSensor_QURT::detect(*this)); +#elif HAL_INS_DEFAULT == HAL_INS_BBBMINI + AP_InertialSensor_Backend *backend = AP_InertialSensor_MPU9250::probe(*this, hal.spi->get_device(HAL_INS_MPU9250_NAME)); + if (backend) { + _add_backend(backend); + hal.console->printf("MPU9250: Onboard IMU detected\n"); + } else { + hal.console->printf("MPU9250: Onboard IMU not detected\n"); + } + + backend = AP_InertialSensor_MPU9250::probe(*this, hal.spi->get_device(HAL_INS_MPU9250_NAME_EXT)); + if (backend) { + _add_backend(backend); + hal.console->printf("MPU9250: External IMU detected\n"); + } else { + hal.console->printf("MPU9250: External IMU not detected\n"); + } #else #error Unrecognised HAL_INS_TYPE setting #endif