修改回放
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
commandprocess::commandprocess(QObject *parent) : QObject(parent)
|
||||
{
|
||||
setRunFrq(10);
|
||||
|
||||
status.m_Mode = Nop_Mode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +108,8 @@ void commandprocess::WriteCmd_int(uint8_t m_sysid, uint8_t m_compid ,
|
||||
int32_t y,
|
||||
float z, uint16_t command, uint8_t frame, uint8_t current, uint8_t autocontinue)
|
||||
{
|
||||
if(status.m_Mode == Nop_Mode)
|
||||
{
|
||||
//给指令赋值
|
||||
cmd_int.param1 = param1;
|
||||
cmd_int.param2 = param2;
|
||||
@@ -123,7 +128,13 @@ void commandprocess::WriteCmd_int(uint8_t m_sysid, uint8_t m_compid ,
|
||||
status.transmit.type = 0;
|
||||
status.m_Mode = TransmitMode;//发送模式
|
||||
|
||||
//start();//开启线程
|
||||
start();//开启线程
|
||||
}
|
||||
else
|
||||
{
|
||||
emit commandAccepted(true,command,0xFF);//广播指令反馈
|
||||
//emit showMessage("Please do not operate too fast");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -131,22 +142,30 @@ void commandprocess::WriteCmd_int(uint8_t m_sysid, uint8_t m_compid ,
|
||||
|
||||
void commandprocess::WriteCmd_long(float param1, float param2, float param3, float param4, float param5, float param6, float param7, uint16_t command, uint8_t confirmation)
|
||||
{
|
||||
//给指令赋值
|
||||
cmd_long.param1 = param1;
|
||||
cmd_long.param2 = param2;
|
||||
cmd_long.param3 = param3;
|
||||
cmd_long.param4 = param4;
|
||||
cmd_long.param5 = param5;
|
||||
cmd_long.param6 = param6;
|
||||
cmd_long.param7 = param7;
|
||||
if(status.m_Mode == Nop_Mode)
|
||||
{
|
||||
//给指令赋值
|
||||
cmd_long.param1 = param1;
|
||||
cmd_long.param2 = param2;
|
||||
cmd_long.param3 = param3;
|
||||
cmd_long.param4 = param4;
|
||||
cmd_long.param5 = param5;
|
||||
cmd_long.param6 = param6;
|
||||
cmd_long.param7 = param7;
|
||||
|
||||
cmd_long.command = command;
|
||||
cmd_long.confirmation = confirmation;
|
||||
cmd_long.command = command;
|
||||
cmd_long.confirmation = confirmation;
|
||||
|
||||
//开启线程开始传输
|
||||
status.m_Mode = TransmitMode;//发送模式
|
||||
status.transmit.type = 1;
|
||||
start();//开启线程
|
||||
//开启线程开始传输
|
||||
status.m_Mode = TransmitMode;//发送模式
|
||||
status.transmit.type = 1;
|
||||
start();//开启线程
|
||||
}
|
||||
else
|
||||
{
|
||||
emit commandAccepted(true,command,0xFF);//广播指令反馈
|
||||
//emit showMessage("Please do not operate too fast");
|
||||
}
|
||||
}
|
||||
|
||||
//这个函数类似中断,专门处理接收到的状态
|
||||
@@ -262,7 +281,7 @@ void commandprocess::WriteStateMachine(void)
|
||||
//清除指令
|
||||
if(status.transmit.type == 0)
|
||||
{
|
||||
emit commandAccepted(false,cmd_int.command,MAV_RESULT::MAV_RESULT_FAILED);
|
||||
emit commandAccepted(false,cmd_int.command,0xFE);//超时
|
||||
|
||||
cmd_int.param1 = 0;
|
||||
cmd_int.param2 = 0;
|
||||
@@ -278,7 +297,7 @@ void commandprocess::WriteStateMachine(void)
|
||||
}
|
||||
else if(status.transmit.type == 1)
|
||||
{
|
||||
emit commandAccepted(false,cmd_long.command,MAV_RESULT::MAV_RESULT_FAILED);
|
||||
emit commandAccepted(false,cmd_long.command,0xFE);//超时
|
||||
|
||||
cmd_long.param1 = 0;
|
||||
cmd_long.param2 = 0;
|
||||
|
||||
Reference in New Issue
Block a user