mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 03:34:07 +08:00
Sensors: Reload calibration whenever a new sensor instance is detected
This commit is contained in:
parent
ca5e1bd62b
commit
7238916d03
@ -2020,6 +2020,11 @@ Sensors::task_main()
|
||||
* do subscriptions
|
||||
*/
|
||||
|
||||
int gcount_prev = _gyro_count;
|
||||
int mcount_prev = _mag_count;
|
||||
int acount_prev = _accel_count;
|
||||
int bcount_prev = _baro_count;
|
||||
|
||||
_gyro_count = init_sensor_class(ORB_ID(sensor_gyro), &_gyro_sub[0],
|
||||
&raw.gyro_priority[0], &raw.gyro_errcount[0]);
|
||||
|
||||
@ -2032,6 +2037,15 @@ Sensors::task_main()
|
||||
_baro_count = init_sensor_class(ORB_ID(sensor_baro), &_baro_sub[0],
|
||||
&raw.baro_priority[0], &raw.baro_errcount[0]);
|
||||
|
||||
if (gcount_prev != _gyro_count ||
|
||||
mcount_prev != _mag_count ||
|
||||
acount_prev != _accel_count ||
|
||||
bcount_prev != _baro_count) {
|
||||
|
||||
/* reload calibration params */
|
||||
parameter_update_poll(true);
|
||||
}
|
||||
|
||||
_rc_sub = orb_subscribe(ORB_ID(input_rc));
|
||||
_diff_pres_sub = orb_subscribe(ORB_ID(differential_pressure));
|
||||
_vcontrol_mode_sub = orb_subscribe(ORB_ID(vehicle_control_mode));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user