Sensors: Reload calibration whenever a new sensor instance is detected

This commit is contained in:
Lorenz Meier 2015-09-27 13:37:18 +02:00
parent ca5e1bd62b
commit 7238916d03

View File

@ -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));