From 33d3e0d17e6719988dcda916fae03a1a665c095c Mon Sep 17 00:00:00 2001 From: vivek-shankar Date: Thu, 26 Jan 2017 22:26:15 -0500 Subject: [PATCH] last multi frame not sent bug correction --- src/CommunicationManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CommunicationManager.cpp b/src/CommunicationManager.cpp index 2d4339a..46ac7de 100644 --- a/src/CommunicationManager.cpp +++ b/src/CommunicationManager.cpp @@ -385,12 +385,12 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() } else{ std::cout << "Multi packet message" << std::endl; - if (multi_msgs.empty()){ + if (multi_msgs.empty() && header[0] == 0){ std::cout << "first message" << std::endl; multi_msgs.insert(make_pair(header[2], in_message)); cur_checksum=header[1]; } - else if (header[1]==cur_checksum) { + else if (header[1]==cur_checksum && header[0] == 0) { std::map< int, std::shared_ptr >::iterator it = multi_msgs.find(header[2]); if(it!=multi_msgs.end()) multi_msgs.erase(it); @@ -554,6 +554,10 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( Generate_Transmit_Request_Frame(temporary_buffer, &frame); serial_device_.Send_Frame(frame); } + if(number==total){ + Generate_Transmit_Request_Frame(temporary_buffer, &frame); + serial_device_.Send_Frame(frame); + } //} }