mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
ekf2: only save mag declination if changed
This commit is contained in:
@@ -1873,12 +1873,14 @@ void EKF2::UpdateMagCalibration(const hrt_abstime ×tamp)
|
|||||||
float declination_deg;
|
float declination_deg;
|
||||||
|
|
||||||
if (_ekf.get_mag_decl_deg(&declination_deg)) {
|
if (_ekf.get_mag_decl_deg(&declination_deg)) {
|
||||||
_param_ekf2_mag_decl.set(declination_deg);
|
_param_ekf2_mag_decl.update();
|
||||||
_mag_decl_saved = true;
|
|
||||||
|
|
||||||
if (!_multi_mode || (_multi_mode && _instance == 0)) {
|
if (PX4_ISFINITE(declination_deg) && (fabsf(declination_deg - _param_ekf2_mag_decl.get()) > 0.1f)) {
|
||||||
|
_param_ekf2_mag_decl.set(declination_deg);
|
||||||
_param_ekf2_mag_decl.commit_no_notification();
|
_param_ekf2_mag_decl.commit_no_notification();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mag_decl_saved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user