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
This commit is contained in:
Andrew Tridgell 2019-03-11 11:15:37 +11:00
parent 9f80e5b5f5
commit 81cd103073
4 changed files with 8 additions and 4 deletions

View File

@ -741,8 +741,10 @@ AP_InertialSensor::detect_backends(void)
ROTATION_ROLL_180_YAW_90, ROTATION_ROLL_180_YAW_90,
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)); 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_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_ext"), ROTATION_ROLL_180_YAW_270));
ADD_BACKEND(AP_InertialSensor_Invensensev2::probe(*this, hal.spi->get_device("icm20948"), ROTATION_ROLL_180_YAW_270));
break; break;
case AP_BoardConfig::PX4_BOARD_FMUV5: case AP_BoardConfig::PX4_BOARD_FMUV5:

View File

@ -102,7 +102,8 @@ public:
DEVTYPE_INS_BMI088 = 0x2B, DEVTYPE_INS_BMI088 = 0x2B,
DEVTYPE_INS_ICM20948 = 0x2C, DEVTYPE_INS_ICM20948 = 0x2C,
DEVTYPE_INS_ICM20648 = 0x2D, DEVTYPE_INS_ICM20648 = 0x2D,
DEVTYPE_INS_ICM20649 = 0x2E DEVTYPE_INS_ICM20649 = 0x2E,
DEVTYPE_INS_ICM20602 = 0x2F,
}; };
protected: protected:

View File

@ -201,10 +201,13 @@ void AP_InertialSensor_Invensense::start()
gdev = DEVTYPE_GYR_MPU9250; gdev = DEVTYPE_GYR_MPU9250;
adev = DEVTYPE_ACC_MPU9250; adev = DEVTYPE_ACC_MPU9250;
break; break;
case Invensense_ICM20602:
gdev = DEVTYPE_INS_ICM20602;
adev = DEVTYPE_INS_ICM20602;
break;
case Invensense_MPU6000: case Invensense_MPU6000:
case Invensense_MPU6500: case Invensense_MPU6500:
case Invensense_ICM20608: case Invensense_ICM20608:
case Invensense_ICM20602:
default: default:
gdev = DEVTYPE_GYR_MPU6000; gdev = DEVTYPE_GYR_MPU6000;
adev = DEVTYPE_ACC_MPU6000; adev = DEVTYPE_ACC_MPU6000;

View File

@ -461,13 +461,11 @@ bool AP_InertialSensor_LSM9DS0::_hardware_init()
whoami_g = _register_read_g(WHO_AM_I_G); whoami_g = _register_read_g(WHO_AM_I_G);
if (whoami_g != LSM9DS0_G_WHOAMI && whoami_g != LSM9DS0_G_WHOAMI_H) { 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; goto fail_whoami;
} }
whoami = _register_read_xm(WHO_AM_I_XM); whoami = _register_read_xm(WHO_AM_I_XM);
if (whoami != LSM9DS0_XM_WHOAMI) { if (whoami != LSM9DS0_XM_WHOAMI) {
hal.console->printf("LSM9DS0: unexpected acc/mag WHOAMI 0x%x\n", (unsigned)whoami);
goto fail_whoami; goto fail_whoami;
} }