add map control

This commit is contained in:
2019-12-31 18:56:34 +08:00
parent df68b6fde8
commit 52614aa68f
136 changed files with 15184 additions and 66 deletions
+38 -44
View File
@@ -2,11 +2,15 @@
MavLinkNode::MavLinkNode(QObject *parent) : QObject(parent)
{
//Nodethread = new QThread();
//this->moveToThread(Nodethread);
running_flag = false;
//connect(Nodethread, &QThread::started, this, &MavLinkNode::process);
Nodethread = new QThread();
this->moveToThread(Nodethread);
connect(Nodethread, &QThread::started, this, &MavLinkNode::process);
//connect(Nodethread, &QThread::finished, Nodethread, &QObject::deleteLater);
qDebug() << "MavLink " << QThread::currentThreadId();
@@ -21,31 +25,32 @@ MavLinkNode::~MavLinkNode()
}
}
//处理好重启机制
void MavLinkNode::start()
{
running_flag = true;
Nodethread = new QThread();
this->moveToThread(Nodethread);
Nodethread->start();
connect(Nodethread, &QThread::started, this, &MavLinkNode::process);
connect(Nodethread, &QThread::finished, this, &QObject::deleteLater);
qDebug() << "thread start" << running_flag;
if(!Nodethread->isRunning())
{
running_flag = true;
Nodethread->start();
qDebug() << "thread start" << running_flag;
}
else
{
qDebug() << "thread has started";
}
}
void MavLinkNode::stop()
{
running_flag = false;
qDebug() << "thread stop" << running_flag;
if(Nodethread->isRunning())
{
running_flag = false;
qDebug() << "thread stop" << running_flag;
}
else
{
qDebug() << "thread is not running";
}
}
@@ -58,36 +63,25 @@ void MavLinkNode::process()//线程函数
qDebug() << "Process " << QThread::currentThreadId();
count ++;
qDebug() << "run 1ms" << count;
qDebug() << "run " << count << "ms";
QThread::msleep(1000);
}
//一旦结束,就立即清除连接
qDebug() << "disconnect";
//disconnect(Nodethread, &QThread::started, this, &MavLinkNode::process);
//disconnect(Nodethread, &QThread::finished, this, &QObject::deleteLater);
//退出线程
Nodethread->quit();
}
/*
void MavLinkNode::start()//线程函数
void MavLinkNode::setbuff(QByteArray data)
{
qDebug() << "run 1ms";
QThread::msleep(1000);
if(buff_select == 1)
{
RawData2.append(data);
}
else if(buff_select == 2)
{
RawData1.append(data);
}
}
*/