diff --git a/include/CommunicationManager.h b/include/CommunicationManager.h index bad78aa..313f823 100644 --- a/include/CommunicationManager.h +++ b/include/CommunicationManager.h @@ -111,9 +111,9 @@ private: uint16_t receiveing_cur_totalsize; uint16_t steps; //uint16_t multi_msg_size; - - int test_1; - struct timeval t1, t2; + uint64_t message_obtmulti[600]; + //int test_1; + //struct timeval t1, t2; }; diff --git a/src/CommunicationManager.cpp b/src/CommunicationManager.cpp index 0febf7a..3d779f9 100644 --- a/src/CommunicationManager.cpp +++ b/src/CommunicationManager.cpp @@ -623,7 +623,7 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( std::cout << "Sending previous multi message not complete yet, so dropping message"<payload64.size(); i++) { @@ -663,7 +663,7 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( memcpy(cpy_buff,&header,sizeof(uint64_t)); tot+=sizeof(uint64_t); /*copy msg size*/ - uint16_t tmp_size = (uint16_t)mavlink_msg->payload64.size(); + uint16_t tmp_size=(uint16_t)mavlink_msg->payload64.size(); memcpy(cpy_buff+tot,&tmp_size,sizeof(uint64_t)); tot+=sizeof(uint16_t); std::cout<<"tmp size in sender"<payload64.size() - uint64_counter >= MAX_NBR_OF_INT64) - tmp_size=(uint16_t)MAX_NBR_OF_INT64; - else tmp_size = mavlink_msg->payload64.size() - uint64_counter; - std::cout<<"tmp size : "<payload64.size()<payload64.size()){ - tmp_size=mavlink_msg->payload64.size() - uint64_counter; */ + if(uint64_counter!=mavlink_msg->payload64.size()){ + tmp_size=mavlink_msg->payload64.size() - uint64_counter; /*Copy the header*/ - /* memcpy(cpy_buff,&header,sizeof(uint64_t)); + memcpy(cpy_buff,&header,sizeof(uint64_t)); tot+=sizeof(uint64_t); memcpy(cpy_buff+tot,&tmp_size,sizeof(uint64_t)); - tot+=sizeof(uint16_t);*/ + tot+=sizeof(uint16_t); /*Copy obt msg*/ - /* memcpy(cpy_buff+tot, message_obt+uint64_counter, ( sizeof(uint64_t) )*tmp_size); + memcpy(cpy_buff+tot, message_obt+uint64_counter, ( sizeof(uint64_t) )*tmp_size); uint64_counter+=tmp_size; - tot+=( sizeof(uint64_t) )*tmp_size;*/ + tot+=( sizeof(uint64_t) )*tmp_size; /*Copy the data to char buff*/ - /* memcpy((void*)temporary_buffer,(void*)cpy_buff,tot); + memcpy((void*)temporary_buffer,(void*)cpy_buff,tot); Generate_Transmit_Request_Frame(temporary_buffer, &frame,tot); multi_msgs_send_dict.push_back(frame); - }*/ + } delete[] cpy_buff; //std::cout << " Received size: " <payload64.size() << std::endl; //std::cout << "total size of multi msg dict mavlink size:" <