From 9405b6f1fe2c736acac296600bfd89d73973a245 Mon Sep 17 00:00:00 2001 From: TobiasSimon Date: Sat, 18 Feb 2012 13:21:01 +0100 Subject: [PATCH] fixed out-of-order bug in packet loss calculation --- src/comm/MAVLinkProtocol.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 77f309f8e..d3924cf81 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -370,7 +370,8 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) int16_t lostMessages = message.seq - expectedIndex; if (lostMessages < 0) { - lostMessages += 256; + // Usually, this happens in the case of an out-of order packet + lostMessages = 0; } qDebug() << QString("Lost %1 messages: expected sequence ID %2 but received %3.").arg(lostMessages).arg(expectedIndex).arg(message.seq); -- 2.22.0