From 81cd1030738de74bd0e56ec6d25e11c9e74a8c69 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 Mar 2019 11:15:37 +1100 Subject: [PATCH] AP_InertialSensor: probe for new v2 invensense IMUs also suppress LSM9DS0 whoami warnings, as these will now be common with new IMUs and make 20602 show up as a new devtype so we can distinguish it --- libraries/AP_InertialSensor/AP_InertialSensor.cpp | 2 ++ libraries/AP_InertialSensor/AP_InertialSensor_Backend.h | 3 ++- libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp | 5 ++++- libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp | 2 -- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index 312e38515f..8fda29bb36 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -741,8 +741,10 @@ AP_InertialSensor::detect_backends(void) ROTATION_ROLL_180_YAW_90, ROTATION_ROLL_180_YAW_90)); ADD_BACKEND(AP_InertialSensor_Invensense::probe(*this, hal.spi->get_device(HAL_INS_MPU9250_NAME), ROTATION_YAW_270)); + // new cubes have ICM20602, ICM2648, ICM20649 ADD_BACKEND(AP_InertialSensor_Invensense::probe(*this, hal.spi->get_device("icm20602_ext"), ROTATION_ROLL_180_YAW_270)); ADD_BACKEND(AP_InertialSensor_Invensensev2::probe(*this, hal.spi->get_device("icm20948_ext"), ROTATION_ROLL_180_YAW_270)); + ADD_BACKEND(AP_InertialSensor_Invensensev2::probe(*this, hal.spi->get_device("icm20948"), ROTATION_ROLL_180_YAW_270)); break; case AP_BoardConfig::PX4_BOARD_FMUV5: diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_Backend.h b/libraries/AP_InertialSensor/AP_InertialSensor_Backend.h index e22a17b171..2af7a6c21d 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_Backend.h +++ b/libraries/AP_InertialSensor/AP_InertialSensor_Backend.h @@ -102,7 +102,8 @@ public: DEVTYPE_INS_BMI088 = 0x2B, DEVTYPE_INS_ICM20948 = 0x2C, DEVTYPE_INS_ICM20648 = 0x2D, - DEVTYPE_INS_ICM20649 = 0x2E + DEVTYPE_INS_ICM20649 = 0x2E, + DEVTYPE_INS_ICM20602 = 0x2F, }; protected: diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp index aee7d4d8f6..f4c2d83308 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_Invensense.cpp @@ -201,10 +201,13 @@ void AP_InertialSensor_Invensense::start() gdev = DEVTYPE_GYR_MPU9250; adev = DEVTYPE_ACC_MPU9250; break; + case Invensense_ICM20602: + gdev = DEVTYPE_INS_ICM20602; + adev = DEVTYPE_INS_ICM20602; + break; case Invensense_MPU6000: case Invensense_MPU6500: case Invensense_ICM20608: - case Invensense_ICM20602: default: gdev = DEVTYPE_GYR_MPU6000; adev = DEVTYPE_ACC_MPU6000; diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp index 0c774ab017..aa69bcfd38 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp @@ -461,13 +461,11 @@ bool AP_InertialSensor_LSM9DS0::_hardware_init() whoami_g = _register_read_g(WHO_AM_I_G); if (whoami_g != LSM9DS0_G_WHOAMI && whoami_g != LSM9DS0_G_WHOAMI_H) { - hal.console->printf("LSM9DS0: unexpected gyro WHOAMI 0x%x\n", (unsigned)whoami_g); goto fail_whoami; } whoami = _register_read_xm(WHO_AM_I_XM); if (whoami != LSM9DS0_XM_WHOAMI) { - hal.console->printf("LSM9DS0: unexpected acc/mag WHOAMI 0x%x\n", (unsigned)whoami); goto fail_whoami; }