From 91e7cab91009007dab5b06d869aac3d98ef881ff Mon Sep 17 00:00:00 2001 From: ImFovery <45708393+ImFovery@users.noreply.github.com> Date: Fri, 18 Nov 2022 17:29:39 +0800 Subject: [PATCH] Don't search MAVLINK_STX with last char of bad packet User A add a new mavlink message, but user B din't add the message. This common situation will lead to extremely occasional packet loss in user B. When user B receive the undefined message, mavlink_parse_char() will enter MAVLINK_FRAMING_BAD_CRC status, and check the undefined message last char. If the last char happens to be MAVLINK_STX value, then the subsequent valid packets will parse wrong and lead to lost. --- mavlink_helpers.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mavlink_helpers.h b/mavlink_helpers.h index 508b8c162..8646b77c9 100644 --- a/mavlink_helpers.h +++ b/mavlink_helpers.h @@ -992,12 +992,6 @@ MAVLINK_HELPER uint8_t mavlink_parse_char(uint8_t chan, uint8_t c, mavlink_messa _mav_parse_error(status); status->msg_received = MAVLINK_FRAMING_INCOMPLETE; status->parse_state = MAVLINK_PARSE_STATE_IDLE; - if (c == MAVLINK_STX) - { - status->parse_state = MAVLINK_PARSE_STATE_GOT_STX; - rxmsg->len = 0; - mavlink_start_checksum(rxmsg); - } return 0; } return msg_received;