charc= UART_2_GetChar();if(mavlink_parse_char(MAVLINK_COMM_0, charc, &msg, &status)){switch(msg.msgid){case (0xAD):{UART_1_PutString("Data Stream ");UART_1_PutCRLF(0X0D);}case (0xA6):{UART_1_PutString("Radio ");UART_1_PutCRLF(0X0D);}case MAVLINK_MSG_ID_MISSION_ACK:{UART_1_PutString("Mission ack ");UART_1_PutCRLF(0X0D);}case MAVLINK_MSG_ID_PARAM_VALUE:{UART_1_PutString("Param value ");UART_1_PutCRLF(0X0D);}default:break;}}}packet_drops += status.packet_rx_drop_count;}while debugging, the if(mavlink_parse_char()) is always false and is not going to switch case part. Can anyone tell whats wrong in my code & what does mavlink_parse_char() returns.
You need to be a member of diydrones to add comments!
Replies
Hello,
It seems that I'm faced with the same problems like Priya.
The function call mavlink_parse_char() never Returns true.
If i try add some debug Information to the code (see the attached file) i get following results:
.........
0 139 0
0 127 0
0 127 0
0 152 0
0 127 0
0 156 0
0 127 0
0 153 0
0 127 0
0 141 0
0 127 0
0 142 0
0 127 0
0 127 0
0 148 0
0 127 0
0 153 0
.........
This tell me, that i receive Messages of the length 127-156 Bytes.
So why mavlink_parse_char() return false?
Can anyone help me??
mavlink_test.ino
void comm_recv()
{
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
uint16_t len;
mavlink_status_t status;
mavlink_message_t msg;
p=UART_2_GetRxBufferSize();
if(UART_2_GetRxBufferSize()>0)
{
charc= UART_2_GetChar();
if((mavlink_parse_char(MAVLINK_COMM_0, charc, &msg, &status)))
{
if(msg.msgid==0x00)
{
UART_1_PutString("Heart Beat ");
}
if(msg.msgid==MAVLINK_MSG_ID_PARAM_VALUE)
{
UART_1_PutString("Param Value ");
}
if(msg.msgid==MAVLINK_MSG_ID_MISSION_ACK)
{
UART_1_PutString("Mission Ack ");
}
if(msg.msgid==0xA6)
{
UART_1_PutString("Radio ");
}
if(msg.msgid==21)
{
UART_1_PutString("Para_Req_list ");
}
if(msg.msgid==43)
{
UART_1_PutString("Mission_Req_list ");
mavlink_mission_request_list_t packet;
mavlink_msg_mission_request_list_decode(&msg, &packet);
mavlink_msg_mission_count_pack(1, 200, &msg,1, 200, 3);
len = mavlink_msg_to_send_buffer(buf, &msg);
UART_2_PutArray(buf, len);
}
if(msg.msgid==43)
{
UART_1_PutString("Mission_Req ");
}
}
}
packet_drops += status.packet_rx_drop_count;
}
But the mission_count packet is not being send. what is the problem??
for(q=0;q
I think i saw a checkbox in mission planner called debug mavlink messages. Might want to try.