mavlink_mission: robustify against dropped ack

This commit handles incoming MISSION_REQUEST_LIST messages such that
they are no longer ignored if the previously requested mission has
sent all mission items but the ack has never been received.

This was the cause for frequent "IGN REQUEST LIST: Busy" warnings
This commit is contained in:
Nico van Duijn
2020-03-19 10:02:28 +01:00
committed by Beat Küng
parent dc8e775d8f
commit 849d3a1b54

View File

@@ -691,6 +691,14 @@ MavlinkMissionManager::handle_mission_request_list(const mavlink_message_t *msg)
mavlink_msg_mission_request_list_decode(msg, &wprl);
if (CHECK_SYSID_COMPID_MISSION(wprl)) {
const bool maybe_completed = (_transfer_seq == current_item_count());
// If all mission items have been sent and a new mission request list comes in, we can proceed even if MISSION_ACK was
// never received. This could happen on a quick reconnect that doesn't trigger MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT
if (maybe_completed) {
switch_to_idle_state();
}
if (_state == MAVLINK_WPM_STATE_IDLE || (_state == MAVLINK_WPM_STATE_SENDLIST
&& (uint8_t)_mission_type == wprl.mission_type)) {
_time_last_recv = hrt_absolute_time();