mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
ekf2: only save mag declination if changed
This commit is contained in:
parent
96bf3aa5d0
commit
4e8c234a55
@ -1873,12 +1873,14 @@ void EKF2::UpdateMagCalibration(const hrt_abstime ×tamp)
|
||||
float declination_deg;
|
||||
|
||||
if (_ekf.get_mag_decl_deg(&declination_deg)) {
|
||||
_param_ekf2_mag_decl.set(declination_deg);
|
||||
_mag_decl_saved = true;
|
||||
_param_ekf2_mag_decl.update();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
_mag_decl_saved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user