Skip to content

Commit

Permalink
Copter: tidy use 'else if' to avoid unnecessary complication in locat…
Browse files Browse the repository at this point in the history
…ion arm checks
  • Loading branch information
peterbarker committed Jun 19, 2024
1 parent b860949 commit e34c91d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions ArduCopter/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e34c91d

Please sign in to comment.