aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Jansen <jnsn.johan@gmail.com>2015-03-08 22:00:38 +0100
committerJohan Jansen <jnsn.johan@gmail.com>2015-03-08 22:00:38 +0100
commitcdbd6872ed24be85f35789fdc0c6da27152411da (patch)
tree720bbf569f07a536c9efb4723e58036e74f60c77
parent1dc7d4905c1c19e6c6a35440866de375c3a929af (diff)
downloadpx4-firmware-cdbd6872ed24be85f35789fdc0c6da27152411da.tar.gz
px4-firmware-cdbd6872ed24be85f35789fdc0c6da27152411da.tar.bz2
px4-firmware-cdbd6872ed24be85f35789fdc0c6da27152411da.zip
AttPosEKF: Fix inverted logic for inhibitMagStates
-rw-r--r--src/modules/ekf_att_pos_estimator/estimator_22states.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/ekf_att_pos_estimator/estimator_22states.cpp b/src/modules/ekf_att_pos_estimator/estimator_22states.cpp
index 0e931e666..cd0ef206e 100644
--- a/src/modules/ekf_att_pos_estimator/estimator_22states.cpp
+++ b/src/modules/ekf_att_pos_estimator/estimator_22states.cpp
@@ -2552,7 +2552,7 @@ void AttPosEKF::setOnGround(const bool isLanded)
bool isMovingForward = _accNavMagHorizontal > 0.5f;
// don't update magnetic field states if on ground or not using compass
- inhibitMagStates = useCompass && !_onGround && (_isFixedWing || isMovingForward);
+ inhibitMagStates = !useCompass || _onGround) || (!_isFixedWing && !isMovingForward);
// don't update terrain offset state if there is no range finder and flying at low velocity or without GPS
if ((_onGround || !useGPS) && !useRangeFinder) {