Commit 9405b6f1 authored by TobiasSimon's avatar TobiasSimon

fixed out-of-order bug in packet loss calculation

parent aaf236a9
...@@ -370,7 +370,8 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -370,7 +370,8 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
int16_t lostMessages = message.seq - expectedIndex; int16_t lostMessages = message.seq - expectedIndex;
if (lostMessages < 0) 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); qDebug() << QString("Lost %1 messages: expected sequence ID %2 but received %3.").arg(lostMessages).arg(expectedIndex).arg(message.seq);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment