修正buffer里面的数据处理方式,以前那个清除之后指针丢失
This commit is contained in:
@@ -153,14 +153,10 @@ void commandprocess::WriteCmd_long(float param1, float param2, float param3, fl
|
||||
//这个函数类似中断,专门处理接收到的状态
|
||||
void commandprocess::Parse(mavlink_message_t msg)
|
||||
{
|
||||
|
||||
|
||||
mavlink_command_int_t command_int;
|
||||
mavlink_command_long_t command_long;
|
||||
mavlink_command_ack_t command_ack;
|
||||
|
||||
|
||||
|
||||
switch (msg.msgid) {
|
||||
case MAVLINK_MSG_ID_COMMAND_INT://几乎不可能收到
|
||||
mavlink_msg_command_int_decode(&msg,&command_int);
|
||||
@@ -173,6 +169,7 @@ void commandprocess::Parse(mavlink_message_t msg)
|
||||
|
||||
if(command_ack.target_system != Current_sysID)
|
||||
{
|
||||
qDebug() << command_ack.target_system << "this msg is'nt mine";
|
||||
break;//如果目标系统不是自己,那么就抛弃该指令
|
||||
}
|
||||
|
||||
@@ -181,6 +178,8 @@ void commandprocess::Parse(mavlink_message_t msg)
|
||||
status.transmit.isWaitingforACK = false;
|
||||
|
||||
emit commandAccepted(true,command_ack.command,command_ack.result);//广播指令反馈
|
||||
|
||||
qDebug() << "command_ack.result" << command_ack.result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -254,7 +253,7 @@ void commandprocess::WriteStateMachine(void)
|
||||
//清除指令
|
||||
if(status.transmit.type == 0)
|
||||
{
|
||||
emit commandAccepted(false,cmd_int.command,0);
|
||||
emit commandAccepted(false,cmd_int.command,MAV_RESULT::MAV_RESULT_FAILED);
|
||||
|
||||
cmd_int.param1 = 0;
|
||||
cmd_int.param2 = 0;
|
||||
@@ -270,7 +269,7 @@ void commandprocess::WriteStateMachine(void)
|
||||
}
|
||||
else if(status.transmit.type == 1)
|
||||
{
|
||||
emit commandAccepted(false,cmd_long.command,0);
|
||||
emit commandAccepted(false,cmd_long.command,MAV_RESULT::MAV_RESULT_FAILED);
|
||||
|
||||
cmd_long.param1 = 0;
|
||||
cmd_long.param2 = 0;
|
||||
|
||||
Reference in New Issue
Block a user