diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index 0a9959ff9b..302e848b14 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -610,6 +610,13 @@ void Compass::_detect_backends(void) ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(0, HAL_COMPASS_LIS3MDL_I2C_ADDR), both_i2c_external, both_i2c_external?ROTATION_YAW_90:ROTATION_NONE), AP_Compass_LIS3MDL::name, both_i2c_external); + + ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(1, HAL_COMPASS_LIS3MDL_I2C_ADDR2), + true, ROTATION_YAW_90), + AP_Compass_LIS3MDL::name, true); + ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(*this, hal.i2c_mgr->get_device(0, HAL_COMPASS_LIS3MDL_I2C_ADDR2), + both_i2c_external, both_i2c_external?ROTATION_YAW_90:ROTATION_NONE), + AP_Compass_LIS3MDL::name, both_i2c_external); // AK09916. This can be found twice, due to the ICM20948 i2c bus pass-thru, so we need to be careful to avoid that if (!_have_driver(AP_HAL::Device::BUS_TYPE_I2C, 1, HAL_COMPASS_AK09916_I2C_ADDR, AP_Compass_Backend::DEVTYPE_ICM20948)) { diff --git a/libraries/AP_Compass/AP_Compass_LIS3MDL.h b/libraries/AP_Compass/AP_Compass_LIS3MDL.h index 327ef95904..bb5b0f1249 100644 --- a/libraries/AP_Compass/AP_Compass_LIS3MDL.h +++ b/libraries/AP_Compass/AP_Compass_LIS3MDL.h @@ -23,10 +23,13 @@ #include "AP_Compass_Backend.h" #ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR -// this can also be on 0x1e # define HAL_COMPASS_LIS3MDL_I2C_ADDR 0x1c #endif +#ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR2 +# define HAL_COMPASS_LIS3MDL_I2C_ADDR2 0x1e +#endif + class AP_Compass_LIS3MDL : public AP_Compass_Backend { public: