Skip to content

Commit

Permalink
Copter: allow arming in GUIDED only from GCS
Browse files Browse the repository at this point in the history
Also changed mode_allows_arming function to accept arming_from_gcs param
Also remove AUTOTUNE from arming list
  • Loading branch information
rmackay9 committed Dec 24, 2014
1 parent c65cb45 commit 6327f4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ArduCopter/flight_mode.pde
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ static bool manual_flight_mode(uint8_t mode) {
return false;
}

static bool mode_allows_arming(uint8_t mode) {
if (manual_flight_mode(mode) || mode == LOITER || mode == ALT_HOLD || mode == POSHOLD || mode == AUTOTUNE || mode == GUIDED) {
// mode_allows_arming - returns true if vehicle can be armed in the specified mode
// arming_from_gcs should be set to true if the arming request comes from the ground station
static bool mode_allows_arming(uint8_t mode, bool arming_from_gcs) {
if (manual_flight_mode(mode) || mode == LOITER || mode == ALT_HOLD || mode == POSHOLD || (arming_from_gcs && mode == GUIDED)) {
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions ArduCopter/motors.pde
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ static bool pre_arm_gps_checks(bool display_failure)

// arm_checks - perform final checks before arming
// always called just before arming. Return true if ok to arm
static bool arm_checks(bool display_failure, bool request_from_gcs)
static bool arm_checks(bool display_failure, bool arming_from_gcs)
{
// always check if the current mode allows arming
if (!mode_allows_arming(control_mode) || (!request_from_gcs && control_mode == GUIDED)) {
if (!mode_allows_arming(control_mode, arming_from_gcs)) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Mode not armable"));
}
Expand Down

0 comments on commit 6327f4a

Please sign in to comment.