From e34c91d1aa02dec00d51f92d23ae68e34941b9be Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 19 Jun 2024 13:36:20 +1000 Subject: [PATCH] Copter: tidy use 'else if' to avoid unnecessary complication in location arm checks --- ArduCopter/AP_Arming.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ArduCopter/AP_Arming.cpp b/ArduCopter/AP_Arming.cpp index 4fbfe125cc..e233180d34 100644 --- a/ArduCopter/AP_Arming.cpp +++ b/ArduCopter/AP_Arming.cpp @@ -450,17 +450,15 @@ bool AP_Arming_Copter::mandatory_gps_checks(bool display_failure) check_failed(display_failure, "Need Position Estimate"); return false; } - } else { - if (fence_requires_gps) { - if (!copter.position_ok()) { - // clarify to user why they need GPS in non-GPS flight mode - check_failed(display_failure, "Fence enabled, need position estimate"); - return false; - } - } else { - // return true if GPS is not required - return true; + } else if (fence_requires_gps) { + if (!copter.position_ok()) { + // clarify to user why they need GPS in non-GPS flight mode + check_failed(display_failure, "Fence enabled, need position estimate"); + return false; } + } else { + // return true if GPS is not required + return true; } // check for GPS glitch (as reported by EKF)