From d0ba259d0d813a83d074912ecd5e6ee1f7769f85 Mon Sep 17 00:00:00 2001 From: priseborough Date: Wed, 19 Oct 2016 21:32:28 +1100 Subject: [PATCH] AP_NavEKF: Fix bug in median filter code --- libraries/AP_NavEKF/AP_NavEKF_core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_NavEKF/AP_NavEKF_core.cpp b/libraries/AP_NavEKF/AP_NavEKF_core.cpp index 8a7978c1cc..63b32990d9 100644 --- a/libraries/AP_NavEKF/AP_NavEKF_core.cpp +++ b/libraries/AP_NavEKF/AP_NavEKF_core.cpp @@ -5137,8 +5137,8 @@ void NavEKF_core::readRangeFinder(void) minIndex = 1; maxIndex = 0; } else { - maxIndex = 0; - minIndex = 1; + minIndex = 0; + maxIndex = 1; } if (storedRngMeas[2] > storedRngMeas[maxIndex]) { midIndex = maxIndex;