mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 19:33:33 +08:00
Mag cal: automatically disable internal mags if external ones are available
This commit is contained in:
committed by
Mathieu Bresciani
parent
430be08131
commit
e3fd50667d
@@ -903,6 +903,15 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
bool param_save = false;
|
||||
bool failed = true;
|
||||
|
||||
bool external_mag_available = false;
|
||||
|
||||
for (unsigned cur_mag = 0; cur_mag < MAX_MAGS; cur_mag++) {
|
||||
if (worker_data.calibration[cur_mag].external() && worker_data.calibration[cur_mag].enabled()) {
|
||||
external_mag_available = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned cur_mag = 0; cur_mag < MAX_MAGS; cur_mag++) {
|
||||
|
||||
calibration::Magnetometer ¤t_cal = worker_data.calibration[cur_mag];
|
||||
@@ -921,6 +930,11 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
current_cal.set_offdiagonal(offdiag[cur_mag]);
|
||||
}
|
||||
|
||||
if (external_mag_available && !current_cal.external()) {
|
||||
// automatically disable the internal mags as they should not be used for navigation
|
||||
current_cal.disable();
|
||||
}
|
||||
|
||||
current_cal.PrintStatus();
|
||||
|
||||
if (current_cal.ParametersSave(cur_mag, true)) {
|
||||
|
||||
Reference in New Issue
Block a user