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;