修改指令界面
This commit is contained in:
@@ -28,18 +28,17 @@ MavLinkNode::MavLinkNode(QObject *parent) : QObject(parent)
|
||||
int Current_sysID = 0xFB;
|
||||
int Current_CompID = MAV_COMP_ID_MISSIONPLANNER;
|
||||
|
||||
CommucationOverTimer = 5000;
|
||||
|
||||
CommucationOverTimer = 1000;
|
||||
|
||||
timer = new QTimer(this);
|
||||
timer->moveToThread(thread);
|
||||
//timer->moveToThread(thread);
|
||||
timer->setInterval(CommucationOverTimer);
|
||||
|
||||
connect(thread, SIGNAL(started()), timer, SLOT(start()));
|
||||
//connect(thread, SIGNAL(started()), timer, SLOT(start()));
|
||||
connect(timer,SIGNAL(timeout()),
|
||||
this,SLOT(TimerOut,Qt::DirectConnection));
|
||||
this,SLOT(TimerOut()),Qt::DirectConnection);
|
||||
|
||||
//timer->start();
|
||||
timer->start();
|
||||
|
||||
qDebug() << "start timer";
|
||||
|
||||
@@ -240,6 +239,8 @@ void MavLinkNode::process()//线程函数
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t count = 0;
|
||||
QByteArray datagram = nullptr;
|
||||
while (running_flag)
|
||||
@@ -276,8 +277,20 @@ void MavLinkNode::process()//线程函数
|
||||
|
||||
void MavLinkNode::TimerOut(void)
|
||||
{
|
||||
isCommunicationLost = true;
|
||||
qDebug() << "timeout" << "communication lost";
|
||||
CommucationOverCount --;
|
||||
|
||||
if(CommucationOverCount <= 0)
|
||||
{
|
||||
CommucationOverCount = 0;
|
||||
isCommunicationLost = true;
|
||||
//qDebug() << "timeout" << "communication lost";
|
||||
|
||||
emit CommuniationLost(isCommunicationLost);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit CommuniationLost(isCommunicationLost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -396,8 +409,11 @@ void MavLinkNode::Mavlinkparse(quint32 src,QByteArray datagram)
|
||||
if(msg.sysid < 250) //过滤地面站发过来的数据
|
||||
{
|
||||
//timer->start();
|
||||
isCommunicationLost = true;
|
||||
|
||||
CommucationOverCount = 5;
|
||||
isCommunicationLost = false;
|
||||
|
||||
//emit CommuniationLost(isCommunicationLost);
|
||||
|
||||
MAVLinkRcv_Handler(msg); //接收完一帧数据并处理
|
||||
emit recievemsg(msg); //将信息广播出去
|
||||
|
||||
Reference in New Issue
Block a user