mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 15:33:34 +08:00
param: automatically update calibration ID params on import
This avoids the need for recalibration, and also cleans up other driver ID's (merge separate accel/gyro). The SPI address was previously set to a board-specific (arbitrary) value, and is now set to 0. This will allow extending for multiple sensors of the same type on the same bus.
This commit is contained in:
@@ -50,7 +50,7 @@ BMP388::BMP388(IBMP388 *interface) :
|
||||
_measure_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": measure")),
|
||||
_comms_errors(perf_alloc(PC_COUNT, MODULE_NAME": comms errors"))
|
||||
{
|
||||
_px4_baro.set_device_type(DRV_DEVTYPE_BMP388);
|
||||
_px4_baro.set_device_type(DRV_BARO_DEVTYPE_BMP388);
|
||||
}
|
||||
|
||||
BMP388::~BMP388()
|
||||
|
||||
@@ -53,7 +53,7 @@ DPS310::DPS310(device::Device *interface) :
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read")),
|
||||
_comms_errors(perf_alloc(PC_COUNT, MODULE_NAME": comm errors"))
|
||||
{
|
||||
_px4_barometer.set_device_type(DRV_DEVTYPE_DPS310);
|
||||
_px4_barometer.set_device_type(DRV_BARO_DEVTYPE_DPS310);
|
||||
}
|
||||
|
||||
DPS310::~DPS310()
|
||||
|
||||
+14
-19
@@ -61,21 +61,19 @@
|
||||
#define DRV_MAG_DEVTYPE_RM3100 0x07
|
||||
#define DRV_MAG_DEVTYPE_QMC5883 0x08
|
||||
#define DRV_MAG_DEVTYPE_AK09916 0x09
|
||||
#define DRV_DEVTYPE_ICM20948 0x0A
|
||||
#define DRV_IMU_DEVTYPE_ICM20948 0x0A
|
||||
|
||||
#define DRV_ACC_DEVTYPE_LSM303D 0x11
|
||||
#define DRV_ACC_DEVTYPE_BMA180 0x12
|
||||
#define DRV_ACC_DEVTYPE_MPU6000 0x13 // TODO: remove this
|
||||
#define DRV_ACC_DEVTYPE_MPU6000_LEGACY 0x13
|
||||
#define DRV_ACC_DEVTYPE_ACCELSIM 0x14
|
||||
#define DRV_ACC_DEVTYPE_MPU9250 0x16 // TOOD: remove this
|
||||
#define DRV_ACC_DEVTYPE_MPU9250_LEGACY 0x16
|
||||
#define DRV_ACC_DEVTYPE_BMI160 0x17
|
||||
|
||||
#define DRV_GYR_DEVTYPE_MPU6000 0x21
|
||||
#define DRV_IMU_DEVTYPE_MPU6000 DRV_GYR_DEVTYPE_MPU6000
|
||||
#define DRV_IMU_DEVTYPE_MPU6000 0x21
|
||||
#define DRV_GYR_DEVTYPE_L3GD20 0x22
|
||||
#define DRV_GYR_DEVTYPE_GYROSIM 0x23
|
||||
#define DRV_GYR_DEVTYPE_MPU9250 0x24
|
||||
#define DRV_IMU_DEVTYPE_MPU9250 DRV_GYR_DEVTYPE_MPU9250
|
||||
#define DRV_IMU_DEVTYPE_MPU9250 0x24
|
||||
#define DRV_GYR_DEVTYPE_BMI160 0x25
|
||||
|
||||
#define DRV_RNG_DEVTYPE_MB12XX 0x31
|
||||
@@ -84,15 +82,12 @@
|
||||
#define DRV_ACC_DEVTYPE_MPU6500 0x34
|
||||
#define DRV_GYR_DEVTYPE_MPU6050 0x35
|
||||
#define DRV_GYR_DEVTYPE_MPU6500 0x36
|
||||
#define DRV_ACC_DEVTYPE_ICM20602 0x37 // TODO: remove this
|
||||
#define DRV_GYR_DEVTYPE_ICM20602 0x38
|
||||
#define DRV_IMU_DEVTYPE_ICM20602 DRV_GYR_DEVTYPE_ICM20602
|
||||
#define DRV_ACC_DEVTYPE_ICM20608 0x39
|
||||
#define DRV_GYR_DEVTYPE_ICM20608 0x3A // TODO: remove this
|
||||
#define DRV_IMU_DEVTYPE_ICM20608 DRV_GYR_DEVTYPE_ICM20608
|
||||
#define DRV_ACC_DEVTYPE_ICM20689 0x3B
|
||||
#define DRV_GYR_DEVTYPE_ICM20689 0x3C // TODO: remove this
|
||||
#define DRV_IMU_DEVTYPE_ICM20689 DRV_GYR_DEVTYPE_ICM20689
|
||||
#define DRV_ACC_DEVTYPE_ICM20602_LEGACY 0x37
|
||||
#define DRV_IMU_DEVTYPE_ICM20602 0x38
|
||||
#define DRV_ACC_DEVTYPE_ICM20608_LEGACY 0x39
|
||||
#define DRV_IMU_DEVTYPE_ICM20608 0x3A
|
||||
#define DRV_ACC_DEVTYPE_ICM20689_LEGACY 0x3B
|
||||
#define DRV_IMU_DEVTYPE_ICM20689 0x3C
|
||||
#define DRV_BARO_DEVTYPE_MS5611 0x3D
|
||||
#define DRV_BARO_DEVTYPE_MS5607 0x3E
|
||||
#define DRV_BARO_DEVTYPE_BMP280 0x3F
|
||||
@@ -126,9 +121,9 @@
|
||||
#define DRV_GYR_DEVTYPE_ADIS16497 0x64
|
||||
#define DRV_BARO_DEVTYPE_BAROSIM 0x65
|
||||
#define DRV_GYR_DEVTYPE_BMI088 0x66
|
||||
#define DRV_DEVTYPE_BMP388 0x67
|
||||
#define DRV_DEVTYPE_DPS310 0x68
|
||||
#define DRV_DEVTYPE_ST_ISM330DLC 0x69
|
||||
#define DRV_BARO_DEVTYPE_BMP388 0x67
|
||||
#define DRV_BARO_DEVTYPE_DPS310 0x68
|
||||
#define DRV_IMU_DEVTYPE_ST_ISM330DLC 0x69
|
||||
#define DRV_ACC_DEVTYPE_BMI088 0x6a
|
||||
#define DRV_OSD_DEVTYPE_ATXXXX 0x6b
|
||||
#define DRV_FLOW_DEVTYPE_PMW3901 0x6c
|
||||
|
||||
@@ -62,7 +62,7 @@ BMI088_accel::BMI088_accel(int bus, const char *path_accel, uint32_t device, enu
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi088_accel_duplicates")),
|
||||
_got_duplicate(false)
|
||||
{
|
||||
_px4_accel.set_device_type(DRV_GYR_DEVTYPE_BMI088);
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_BMI088);
|
||||
}
|
||||
|
||||
BMI088_accel::~BMI088_accel()
|
||||
|
||||
@@ -100,8 +100,8 @@ ICM20948::ICM20948(device::Device *interface, device::Device *mag_interface, enu
|
||||
_good_transfers(perf_alloc(PC_COUNT, MODULE_NAME": good_trans")),
|
||||
_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": dupe"))
|
||||
{
|
||||
_px4_accel.set_device_type(DRV_DEVTYPE_ICM20948);
|
||||
_px4_gyro.set_device_type(DRV_DEVTYPE_ICM20948);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20948);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20948);
|
||||
}
|
||||
|
||||
ICM20948::~ICM20948()
|
||||
|
||||
@@ -72,7 +72,7 @@ ICM20948_I2C_interface(int bus, uint32_t address)
|
||||
ICM20948_I2C::ICM20948_I2C(int bus, uint32_t address) :
|
||||
I2C("ICM20948_I2C", nullptr, bus, address, 400000)
|
||||
{
|
||||
_device_id.devid_s.devtype = DRV_DEVTYPE_ICM20948;
|
||||
_device_id.devid_s.devtype = DRV_IMU_DEVTYPE_ICM20948;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -92,7 +92,7 @@ ICM20948_SPI_interface(int bus, uint32_t cs)
|
||||
ICM20948_SPI::ICM20948_SPI(int bus, uint32_t device) :
|
||||
SPI("ICM20948", nullptr, bus, device, SPIDEV_MODE3, ICM20948_LOW_SPI_BUS_SPEED)
|
||||
{
|
||||
_device_id.devid_s.devtype = DRV_DEVTYPE_ICM20948;
|
||||
_device_id.devid_s.devtype = DRV_IMU_DEVTYPE_ICM20948;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -69,7 +69,7 @@ AK09916_I2C_interface(int bus)
|
||||
AK09916_I2C::AK09916_I2C(int bus) :
|
||||
I2C("AK09916_I2C", nullptr, bus, AK09916_I2C_ADDR, 400000)
|
||||
{
|
||||
_device_id.devid_s.devtype = DRV_DEVTYPE_ICM20948;
|
||||
_device_id.devid_s.devtype = DRV_IMU_DEVTYPE_ICM20948;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -48,10 +48,9 @@ ICM20602::ICM20602(int bus, uint32_t device, enum Rotation rotation) :
|
||||
_px4_accel(get_device_id(), ORB_PRIO_VERY_HIGH, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_VERY_HIGH, rotation)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_ICM20602);
|
||||
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_ICM20602);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_ICM20602);
|
||||
set_device_type(DRV_IMU_DEVTYPE_ICM20602);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20602);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20602);
|
||||
|
||||
ConfigureSampleRate(_px4_gyro.get_max_rate_hz());
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ ICM20608G::ICM20608G(int bus, uint32_t device, enum Rotation rotation) :
|
||||
_px4_accel(get_device_id(), ORB_PRIO_VERY_HIGH, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_VERY_HIGH, rotation)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_ICM20608);
|
||||
set_device_type(DRV_IMU_DEVTYPE_ICM20608);
|
||||
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_ICM20608);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_ICM20608);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20608);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20608);
|
||||
|
||||
ConfigureSampleRate(_px4_gyro.get_max_rate_hz());
|
||||
}
|
||||
|
||||
@@ -48,10 +48,9 @@ ICM20689::ICM20689(int bus, uint32_t device, enum Rotation rotation) :
|
||||
_px4_accel(get_device_id(), ORB_PRIO_VERY_HIGH, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_VERY_HIGH, rotation)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_ICM20689);
|
||||
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_ICM20689);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_ICM20689);
|
||||
set_device_type(DRV_IMU_DEVTYPE_ICM20689);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20689);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20689);
|
||||
|
||||
ConfigureSampleRate(_px4_gyro.get_max_rate_hz());
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ MPU6000::MPU6000(int bus, uint32_t device, enum Rotation rotation) :
|
||||
_px4_accel(get_device_id(), ORB_PRIO_VERY_HIGH, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_VERY_HIGH, rotation)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_MPU6000);
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_MPU6000);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_MPU6000);
|
||||
set_device_type(DRV_IMU_DEVTYPE_MPU6000);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_MPU6000);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_MPU6000);
|
||||
|
||||
_px4_accel.set_update_rate(1000000 / FIFO_INTERVAL);
|
||||
_px4_gyro.set_update_rate(1000000 / FIFO_INTERVAL);
|
||||
|
||||
@@ -48,10 +48,9 @@ MPU9250::MPU9250(int bus, uint32_t device, enum Rotation rotation) :
|
||||
_px4_accel(get_device_id(), ORB_PRIO_VERY_HIGH, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_VERY_HIGH, rotation)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_MPU9250);
|
||||
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_MPU9250);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_MPU9250);
|
||||
set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
|
||||
ConfigureSampleRate(_px4_gyro.get_max_rate_hz());
|
||||
}
|
||||
|
||||
@@ -54,23 +54,23 @@ MPU6000::MPU6000(device::Device *interface, enum Rotation rotation, int device_t
|
||||
switch (_device_type) {
|
||||
default:
|
||||
case MPU_DEVICE_TYPE_MPU6000:
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_MPU6000);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_MPU6000);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_MPU6000);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_MPU6000);
|
||||
break;
|
||||
|
||||
case MPU_DEVICE_TYPE_ICM20602:
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_ICM20602);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_ICM20602);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20602);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20602);
|
||||
break;
|
||||
|
||||
case MPU_DEVICE_TYPE_ICM20608:
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_ICM20608);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_ICM20608);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20608);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20608);
|
||||
break;
|
||||
|
||||
case MPU_DEVICE_TYPE_ICM20689:
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_ICM20689);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_ICM20689);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ICM20689);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ICM20689);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ MPU9250::MPU9250(device::Device *interface, device::Device *mag_interface, enum
|
||||
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad_reg")),
|
||||
_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": dupe"))
|
||||
{
|
||||
_px4_accel.set_device_type(DRV_ACC_DEVTYPE_MPU9250);
|
||||
_px4_gyro.set_device_type(DRV_GYR_DEVTYPE_MPU9250);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
}
|
||||
|
||||
MPU9250::~MPU9250()
|
||||
|
||||
@@ -70,7 +70,7 @@ MPU9250_I2C_interface(int bus, uint32_t address)
|
||||
MPU9250_I2C::MPU9250_I2C(int bus, uint32_t address) :
|
||||
I2C("MPU9250_I2C", nullptr, bus, address, 400000)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_MPU9250);
|
||||
set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -88,7 +88,7 @@ MPU9250_SPI_interface(int bus, uint32_t cs)
|
||||
MPU9250_SPI::MPU9250_SPI(int bus, uint32_t device) :
|
||||
SPI("MPU9250", nullptr, bus, device, SPIDEV_MODE3, MPU9250_LOW_SPI_BUS_SPEED)
|
||||
{
|
||||
set_device_type(DRV_ACC_DEVTYPE_MPU9250);
|
||||
set_device_type(DRV_IMU_DEVTYPE_MPU9250);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -48,9 +48,9 @@ ISM330DLC::ISM330DLC(int bus, uint32_t device, enum Rotation rotation) :
|
||||
_px4_accel(get_device_id(), ORB_PRIO_DEFAULT, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_DEFAULT, rotation)
|
||||
{
|
||||
set_device_type(DRV_DEVTYPE_ST_ISM330DLC);
|
||||
_px4_accel.set_device_type(DRV_DEVTYPE_ST_ISM330DLC);
|
||||
_px4_gyro.set_device_type(DRV_DEVTYPE_ST_ISM330DLC);
|
||||
set_device_type(DRV_IMU_DEVTYPE_ST_ISM330DLC);
|
||||
_px4_accel.set_device_type(DRV_IMU_DEVTYPE_ST_ISM330DLC);
|
||||
_px4_gyro.set_device_type(DRV_IMU_DEVTYPE_ST_ISM330DLC);
|
||||
|
||||
_px4_accel.set_update_rate(1000000 / FIFO_INTERVAL);
|
||||
_px4_gyro.set_update_rate(1000000 / FIFO_INTERVAL);
|
||||
|
||||
Reference in New Issue
Block a user