From 9ee4bf9bf50900d824e234ce1c4722c81118cfcb Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 21 Mar 2022 14:24:24 -0400 Subject: [PATCH] ekf2: delete isStrongMagneticDisturbance() --- src/modules/ekf2/EKF/ekf.h | 1 - src/modules/ekf2/EKF/mag_control.cpp | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/ekf2/EKF/ekf.h b/src/modules/ekf2/EKF/ekf.h index f7c27fa578..b02f98e9bb 100644 --- a/src/modules/ekf2/EKF/ekf.h +++ b/src/modules/ekf2/EKF/ekf.h @@ -858,7 +858,6 @@ private: void checkMagInhibition(); bool shouldInhibitMag() const; void checkMagFieldStrength(const Vector3f &mag); - bool isStrongMagneticDisturbance() const { return _control_status.flags.mag_field_disturbed; } static bool isMeasuredMatchingExpected(float measured, float expected, float gate); void runMagAndMagDeclFusions(const Vector3f &mag); void run3DMagAndDeclFusions(const Vector3f &mag); diff --git a/src/modules/ekf2/EKF/mag_control.cpp b/src/modules/ekf2/EKF/mag_control.cpp index ebcaabb7fb..db990b58e5 100644 --- a/src/modules/ekf2/EKF/mag_control.cpp +++ b/src/modules/ekf2/EKF/mag_control.cpp @@ -189,7 +189,7 @@ void Ekf::runOnGroundYawReset() bool Ekf::canResetMagHeading() const { - return !isStrongMagneticDisturbance() && (_params.mag_fusion_type != MAG_FUSE_TYPE_NONE); + return !_control_status.flags.mag_field_disturbed && (_params.mag_fusion_type != MAG_FUSE_TYPE_NONE); } void Ekf::runInAirYawReset(const Vector3f &mag_sample) @@ -313,8 +313,7 @@ bool Ekf::shouldInhibitMag() const && !_control_status.flags.ev_pos && !_control_status.flags.ev_vel; - return (user_selected && heading_not_required_for_navigation) - || isStrongMagneticDisturbance(); + return (user_selected && heading_not_required_for_navigation) || _control_status.flags.mag_field_disturbed; } void Ekf::checkMagFieldStrength(const Vector3f &mag_sample)