sensors (accel/gyro/mag) determine if external with device id

This commit is contained in:
Daniel Agar
2022-01-10 10:31:07 -05:00
committed by GitHub
parent 45040be669
commit e731fcdbc0
36 changed files with 187 additions and 205 deletions
@@ -535,8 +535,6 @@ bool ADIS16448::Configure()
_px4_accel.set_range(18.f * CONSTANTS_ONE_G);
_px4_gyro.set_range(math::radians(1000.f));
_px4_mag.set_external(external());
return success;
}
@@ -51,7 +51,6 @@ ICM20948_AK09916::ICM20948_AK09916(ICM20948 &icm20948, enum Rotation rotation) :
_px4_mag(icm20948.get_device_id(), rotation)
{
_px4_mag.set_device_type(DRV_MAG_DEVTYPE_AK09916);
_px4_mag.set_external(icm20948.external());
// mag resolution is 1.5 milli Gauss per bit (0.15 μT/LSB)
_px4_mag.set_scale(1.5e-3f);
@@ -51,7 +51,6 @@ MPU9250_AK8963::MPU9250_AK8963(MPU9250 &mpu9250, enum Rotation rotation) :
_px4_mag(mpu9250.get_device_id(), rotation)
{
_px4_mag.set_device_type(DRV_MAG_DEVTYPE_AK8963);
_px4_mag.set_external(mpu9250.external());
// in 16-bit sampling mode the mag resolution is 1.5 milli Gauss per bit */
_px4_mag.set_scale(1.5e-3f);
-2
View File
@@ -64,7 +64,6 @@ LSM303D::LSM303D(const I2CSPIDriverConfig &config) :
_bad_values(perf_alloc(PC_COUNT, "lsm303d: bad_val")),
_accel_duplicates(perf_alloc(PC_COUNT, "lsm303d: acc_dupe"))
{
_px4_mag.set_external(external());
}
LSM303D::~LSM303D()
@@ -558,7 +557,6 @@ LSM303D::measureMagnetometer()
_px4_mag.set_temperature(_last_temperature);
_px4_mag.set_error_count(perf_event_count(_bad_registers) + perf_event_count(_bad_values));
_px4_mag.set_external(external());
_px4_mag.update(timestamp_sample, raw_mag_report.x, raw_mag_report.y, raw_mag_report.z);
_mag_last_measure = timestamp_sample;
@@ -45,7 +45,6 @@ AK09916::AK09916(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
AK09916::~AK09916()
@@ -45,7 +45,6 @@ AK8963::AK8963(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
AK8963::~AK8963()
@@ -40,7 +40,6 @@ BMM150::BMM150(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
BMM150::~BMM150()
+1 -2
View File
@@ -48,7 +48,6 @@ HMC5883::HMC5883(device::Device *interface, const I2CSPIDriverConfig &config) :
_temperature_counter(0),
_temperature_error_count(0)
{
_px4_mag.set_external(_interface->external());
}
HMC5883::~HMC5883()
@@ -367,7 +366,7 @@ int HMC5883::collect()
* to align the sensor axes with the board, x and y need to be flipped
* and y needs to be negated
*/
if (!_px4_mag.external()) {
if (!_interface->external()) {
// convert onboard so it matches offboard for the
// scaling below
report.y = -report.y;
@@ -45,7 +45,6 @@ IST8308::IST8308(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
IST8308::~IST8308()
@@ -45,7 +45,6 @@ IST8310::IST8310(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
IST8310::~IST8310()
@@ -52,7 +52,6 @@ LIS2MDL::LIS2MDL(device::Device *interface, const I2CSPIDriverConfig &config) :
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read")),
_measure_interval(0)
{
_px4_mag.set_external(_interface->external());
_px4_mag.set_scale(0.0015f); /* 49.152f / (2^15) */
}
@@ -65,7 +65,6 @@ LIS3MDL::LIS3MDL(device::Device *interface, const I2CSPIDriverConfig &config) :
_temperature_counter(0),
_temperature_error_count(0)
{
_px4_mag.set_external(_interface->external());
}
LIS3MDL::~LIS3MDL()
@@ -69,8 +69,6 @@ LSM303AGR::LSM303AGR(const I2CSPIDriverConfig &config) :
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad_reg")),
_bad_values(perf_alloc(PC_COUNT, MODULE_NAME": bad_val"))
{
_px4_mag.set_external(external());
_px4_mag.set_scale(1.5f / 1000.f); // 1.5 milligauss/LSB
}
@@ -45,7 +45,6 @@ LSM9DS1_MAG::LSM9DS1_MAG(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
LSM9DS1_MAG::~LSM9DS1_MAG()
@@ -45,7 +45,6 @@ QMC5883L::QMC5883L(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
QMC5883L::~QMC5883L()
@@ -54,8 +54,6 @@ RM3100::RM3100(device::Device *interface, const I2CSPIDriverConfig &config) :
_measure_interval(0),
_check_state_cnt(0)
{
_px4_mag.set_external(_interface->external());
_px4_mag.set_scale(1.f / (RM3100_SENSITIVITY * UTESLA_TO_GAUSS));
}
@@ -45,7 +45,6 @@ VCM1193L::VCM1193L(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_px4_mag.set_external(external());
}
VCM1193L::~VCM1193L()
-2
View File
@@ -144,7 +144,5 @@ int UavcanMagnetometerBridge::init_driver(uavcan_bridge::Channel *channel)
return PX4_ERROR;
}
mag->set_external(true);
return PX4_OK;
}