mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 23:43:34 +08:00
move initial sensor priority to parameters and purge ORB_PRIORITY
- CAL_ACCx_EN -> CAL_ACCx_PRIO - CAL_GYROx_EN -> CAL_GYROx_PRIO - CAL_MAGx_EN -> CAL_MAGx_PRIO
This commit is contained in:
@@ -122,6 +122,24 @@ void VehicleMagnetometer::ParametersUpdate(bool force)
|
||||
}
|
||||
|
||||
_mag_comp_type = mag_comp_typ;
|
||||
|
||||
// update mag priority (CAL_MAGx_PRIO)
|
||||
for (int mag = 0; mag < MAX_SENSOR_COUNT; mag++) {
|
||||
const int32_t priority_old = _calibration[mag].priority();
|
||||
_calibration[mag].ParametersUpdate();
|
||||
const int32_t priority_new = _calibration[mag].priority();
|
||||
|
||||
if (priority_old != priority_new) {
|
||||
if (_priority[mag] == priority_old) {
|
||||
_priority[mag] = priority_new;
|
||||
|
||||
} else {
|
||||
// change relative priority to incorporate any sensor faults
|
||||
int priority_change = priority_new - priority_old;
|
||||
_priority[mag] = math::constrain(_priority[mag] + priority_change, 1, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +225,7 @@ void VehicleMagnetometer::Run()
|
||||
if (_calibration[uorb_index].device_id() != report.device_id) {
|
||||
_calibration[uorb_index].set_external(report.is_external);
|
||||
_calibration[uorb_index].set_device_id(report.device_id);
|
||||
_priority[uorb_index] = _sensor_sub[uorb_index].get_priority();
|
||||
_priority[uorb_index] = _calibration[uorb_index].priority();
|
||||
}
|
||||
|
||||
if (_calibration[uorb_index].enabled()) {
|
||||
|
||||
Reference in New Issue
Block a user