From 32c7fe996a04b0f9fc65a113cf5c284f22ca81e2 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 19 Aug 2015 12:03:32 +0900 Subject: [PATCH] NavEKF: IMU ratio set to primary accel when neither IMU is used This forces the EKF IMU ratio to indicate which IMU is used except that it will be "0" in the unlikely case that the third IMU is used --- libraries/AP_NavEKF/AP_NavEKF.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/AP_NavEKF/AP_NavEKF.cpp b/libraries/AP_NavEKF/AP_NavEKF.cpp index 5956be4e62..1e243c455a 100644 --- a/libraries/AP_NavEKF/AP_NavEKF.cpp +++ b/libraries/AP_NavEKF/AP_NavEKF.cpp @@ -4187,7 +4187,11 @@ void NavEKF::readIMUData() lastImuSwitchState = 2; } else { readDeltaVelocity(ins.get_primary_accel(), dVelIMU1, dtDelVel1); - lastImuSwitchState = 0; + if (ins.get_primary_accel() < 2) { + lastImuSwitchState = ins.get_primary_accel() + 1; + } else { + lastImuSwitchState = 0; + } } dtDelVel2 = dtDelVel1; dVelIMU2 = dVelIMU1;