mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
mavlink: support mission transfer cancellation (#14139)
This adds support for MAV_MISSION_OPERATION_CANCELLED which can be used to cancel an ongoing upload or download of mission/geofence/rally items.
This commit is contained in:
parent
6c8f39c5d8
commit
f3fefd7d93
@ -601,14 +601,16 @@ MavlinkMissionManager::handle_mission_ack(const mavlink_message_t *msg)
|
||||
if (CHECK_SYSID_COMPID_MISSION(wpa)) {
|
||||
if ((msg->sysid == _transfer_partner_sysid && msg->compid == _transfer_partner_compid)) {
|
||||
if (_state == MAVLINK_WPM_STATE_SENDLIST && _mission_type == wpa.mission_type) {
|
||||
|
||||
_time_last_recv = hrt_absolute_time();
|
||||
|
||||
if (_transfer_seq == current_item_count()) {
|
||||
if (wpa.type == MAV_MISSION_ACCEPTED && _transfer_seq == current_item_count()) {
|
||||
PX4_DEBUG("WPM: MISSION_ACK OK all items sent, switch to state IDLE");
|
||||
|
||||
} else {
|
||||
_mavlink->send_statustext_critical("WPM: ERR: not all items sent -> IDLE");
|
||||
} else if (wpa.type == MAV_MISSION_OPERATION_CANCELLED) {
|
||||
PX4_DEBUG("WPM: MISSION_ACK CANCELLED, switch to state IDLE");
|
||||
|
||||
} else {
|
||||
PX4_DEBUG("WPM: MISSION_ACK ERROR: not all items sent, switch to state IDLE anyway");
|
||||
}
|
||||
|
||||
@ -628,6 +630,11 @@ MavlinkMissionManager::handle_mission_ack(const mavlink_message_t *msg)
|
||||
send_mission_request(_transfer_partner_sysid, _transfer_partner_compid, _transfer_seq);
|
||||
}
|
||||
|
||||
} else if (wpa.type == MAV_MISSION_OPERATION_CANCELLED) {
|
||||
PX4_DEBUG("WPM: MISSION_ACK CANCELLED, switch to state IDLE");
|
||||
switch_to_idle_state();
|
||||
_transfer_in_progress = false;
|
||||
|
||||
} else if (wpa.type != MAV_MISSION_ACCEPTED) {
|
||||
PX4_WARN("Mission ack result was %d", wpa.type);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user