Commit 3f857339 authored by Don Gagne's avatar Don Gagne

Fix image packet code

These changes prevent random encapsulated data packets as being thought
to be images.
parent e2ce56dc
......@@ -149,6 +149,8 @@ UAS::UAS(MAVLinkProtocol* protocol, QThread* thread, int id) : UASInterface(),
pitch(0.0),
yaw(0.0),
imagePackets(0), // We must initialize to 0, otherwise extended data packets maybe incorrectly thought to be images
blockHomePositionChanges(false),
receivedMode(false),
......@@ -1321,6 +1323,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// NO VALID TRANSACTION - ABORT
// Restart statemachine
imagePacketsArrived = 0;
break;
}
for (int i = 0; i < imagePayload; ++i)
......@@ -1337,6 +1340,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if ((imagePacketsArrived >= imagePackets))
{
// Restart statemachine
imagePackets = 0;
imagePacketsArrived = 0;
emit imageReady(this);
//qDebug() << "imageReady emitted. all packets arrived";
}
......
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