mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 13:31:27 +08:00
fix(mavlink): check protocol timeout before GETLIST retry (#27377)
Co-authored-by: 0xDI <0xDI@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user