mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-26 18:48:30 -04:00
GCS_MAVLink: add do_disarm_checks boolean to disarm call
this creates symmetry between arming and disarming, at least as far as the top-level arm() and disarm() calls are concerned.
This commit is contained in:
parent
b229c552e6
commit
3d577d94e8
@ -511,8 +511,6 @@ protected:
|
||||
static constexpr const float magic_force_arm_value = 2989.0f;
|
||||
static constexpr const float magic_force_disarm_value = 21196.0f;
|
||||
|
||||
virtual bool allow_disarm() const { return true; }
|
||||
|
||||
void manual_override(RC_Channel *c, int16_t value_in, uint16_t offset, float scaler, const uint32_t tnow, bool reversed = false);
|
||||
|
||||
/*
|
||||
|
@ -3864,13 +3864,9 @@ MAV_RESULT GCS_MAVLINK::handle_command_component_arm_disarm(const mavlink_comman
|
||||
if (!AP::arming().is_armed()) {
|
||||
return MAV_RESULT_ACCEPTED;
|
||||
}
|
||||
// allow vehicle to disallow disarm. Copter does this if
|
||||
// the vehicle isn't considered landed.
|
||||
if (!allow_disarm() &&
|
||||
!is_equal(packet.param2, magic_force_disarm_value)) {
|
||||
return MAV_RESULT_FAILED;
|
||||
}
|
||||
if (AP::arming().disarm(AP_Arming::Method::MAVLINK)) {
|
||||
const bool forced = is_equal(packet.param2, magic_force_disarm_value);
|
||||
// note disarm()'s second parameter is "do_disarm_checks"
|
||||
if (AP::arming().disarm(AP_Arming::Method::MAVLINK, !forced)) {
|
||||
return MAV_RESULT_ACCEPTED;
|
||||
}
|
||||
return MAV_RESULT_FAILED;
|
||||
|
Loading…
Reference in New Issue
Block a user