fix(mavlink): check protocol timeout before GETLIST retry (#27377)

Co-authored-by: 0xDI <0xDI@users.noreply.github.com>
This commit is contained in:
Dimitris
2026-05-19 01:11:39 +03:00
committed by GitHub
parent 3cd7c3694a
commit edd44e21d6

View File

@@ -558,8 +558,22 @@ MavlinkMissionManager::send()
}
/* check for timed-out operations */
if (_state == MAVLINK_WPM_STATE_GETLIST && (_time_last_sent > 0)
&& hrt_elapsed_time(&_time_last_sent) > MAVLINK_MISSION_RETRY_TIMEOUT_DEFAULT) {
if (_state != MAVLINK_WPM_STATE_IDLE && (_time_last_recv > 0)
&& hrt_elapsed_time(&_time_last_recv) > MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT) {
_mavlink.send_statustext_critical("Mission sync timeout\t");
events::send(events::ID("mavlink_mission_sync_timeout"), events::Log::Error,
"Mission sync timeout, aborting transfer");
PX4_DEBUG("WPM: Last operation (state=%d) timed out, changing state to MAVLINK_WPM_STATE_IDLE", _state);
switch_to_idle_state();
// since we are giving up, reset this state also, so another request can be started.
_transfer_in_progress = false;
} else if (_state == MAVLINK_WPM_STATE_GETLIST && (_time_last_sent > 0)
&& hrt_elapsed_time(&_time_last_sent) > MAVLINK_MISSION_RETRY_TIMEOUT_DEFAULT) {
// try to request item again after timeout
send_mission_request(_transfer_partner_sysid, _transfer_partner_compid, _transfer_seq);
@@ -573,20 +587,6 @@ MavlinkMissionManager::send()
send_mission_count(_transfer_partner_sysid, _transfer_partner_compid, _transfer_count, _mission_type,
get_current_mission_type_crc());
} else if (_state != MAVLINK_WPM_STATE_IDLE && (_time_last_recv > 0)
&& hrt_elapsed_time(&_time_last_recv) > MAVLINK_MISSION_PROTOCOL_TIMEOUT_DEFAULT) {
_mavlink.send_statustext_critical("Mission sync timeout\t");
events::send(events::ID("mavlink_mission_sync_timeout"), events::Log::Error,
"Mission sync timeout, aborting transfer");
PX4_DEBUG("WPM: Last operation (state=%d) timed out, changing state to MAVLINK_WPM_STATE_IDLE", _state);
switch_to_idle_state();
// since we are giving up, reset this state also, so another request can be started.
_transfer_in_progress = false;
} else if (_state == MAVLINK_WPM_STATE_IDLE) {
// reset flags
_time_last_sent = 0;