From 5ea0ef39cdd50e8b634dd38e72e48844e660a11c Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Tue, 9 Feb 2016 07:44:34 +1100 Subject: [PATCH] EKF: Update declination fusion logic We do not need to run declination fusion if 3-axis mag fusion is not being used. --- EKF/control.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EKF/control.cpp b/EKF/control.cpp index 104a5f21bd..ae34a76504 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -111,11 +111,11 @@ void Ekf::controlFusionModes() } // if we are using 3-axis magnetometer fusion, but without external aiding, then the declination needs to be fused as an observation to prevent long term heading drift - if (_control_status.flags.mag_3D && _control_status.flags.gps) { - _control_status.flags.mag_dec = false; + if (_control_status.flags.mag_3D && !_control_status.flags.gps) { + _control_status.flags.mag_dec = true; } else { - _control_status.flags.mag_dec = true; + _control_status.flags.mag_dec = false; } }