forked from Archive/PX4-Autopilot
Fixed in-air restart
This commit is contained in:
parent
d717b6f940
commit
826d5687be
|
@ -470,8 +470,26 @@ void handle_command(struct vehicle_status_s *status, const struct safety_s *safe
|
||||||
}
|
}
|
||||||
|
|
||||||
case VEHICLE_CMD_COMPONENT_ARM_DISARM:
|
case VEHICLE_CMD_COMPONENT_ARM_DISARM:
|
||||||
// XXX implement later
|
{
|
||||||
result = VEHICLE_CMD_RESULT_DENIED;
|
transition_result_t arming_res = TRANSITION_NOT_CHANGED;
|
||||||
|
if (!armed->armed && ((int)(cmd->param1 + 0.5f)) == 1) {
|
||||||
|
if (safety->safety_switch_available && !safety->safety_off) {
|
||||||
|
print_reject_arm("NOT ARMING: Press safety switch first.");
|
||||||
|
arming_res = TRANSITION_DENIED;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
arming_res = arming_state_transition(status, safety, ARMING_STATE_ARMED, armed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arming_res == TRANSITION_CHANGED) {
|
||||||
|
mavlink_log_info(mavlink_fd, "[cmd] ARMED by component arm cmd");
|
||||||
|
result = VEHICLE_CMD_RESULT_ACCEPTED;
|
||||||
|
} else {
|
||||||
|
mavlink_log_info(mavlink_fd, "[cmd] REJECTING component arm cmd");
|
||||||
|
result = VEHICLE_CMD_RESULT_TEMPORARILY_REJECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue