完全移植929 mavlinkNode
This commit is contained in:
+11
-12
@@ -39,7 +39,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# include sub project
|
||||
|
||||
DESTDIR = $$PWD/../bin
|
||||
DESTDIR = $$PWD/../thirdpart/lib
|
||||
MOC_DIR = $$PWD/../build
|
||||
OBJECTS_DIR = $$PWD/../build
|
||||
|
||||
@@ -73,18 +73,18 @@ SOURCES += \
|
||||
sbusparser.cpp \
|
||||
statusprocess.cpp
|
||||
|
||||
INCLUDEPATH += $$DESTDIR/include
|
||||
INCLUDEPATH += $$PWD/../thirdpart/include
|
||||
|
||||
# Capture whether this is a release/debug build.
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -L$$DESTDIR -lcored
|
||||
LIBS += -L$$DESTDIR -linternalsd
|
||||
LIBS += -L$$DESTDIR -lopmapwidgetd
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lcored
|
||||
LIBS += -L$$PWD/../thirdpart/lib -linternalsd
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lopmapwidgetd
|
||||
}
|
||||
CONFIG(release, debug|release) {
|
||||
LIBS += -L$$DESTDIR -lcore
|
||||
LIBS += -L$$DESTDIR -linternals
|
||||
LIBS += -L$$DESTDIR -lopmapwidget
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lcore
|
||||
LIBS += -L$$PWD/../thirdpart/lib -linternals
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lopmapwidget
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ INCLUDEPATH += $$PWD/../mavlink \
|
||||
|
||||
|
||||
|
||||
win32|win64 {
|
||||
win32|win64 {
|
||||
src_dir = $$PWD\\*.h
|
||||
dst_dir = $$PWD\\..\\bin\\include\\
|
||||
dst_dir = $$PWD\\..\\thirdpart\\include\\
|
||||
# dst_dir 最后的 \\ 是必须的,用来标示 xcopy 到一个文件夹,若不存在,创建之
|
||||
|
||||
# Replace slashes in paths with backslashes for Windows
|
||||
@@ -114,13 +114,12 @@ win32|win64 {
|
||||
dst_dir ~= s,/,\\,g
|
||||
|
||||
system(xcopy $$src_dir $$dst_dir /y /e)
|
||||
|
||||
}
|
||||
|
||||
|
||||
unix {
|
||||
src_dir = $$PWD/*.h
|
||||
dst_dir = $$PWD/../bin/include/
|
||||
dst_dir = $$PWD/../thirdpart/include/
|
||||
|
||||
!exists($$dst_dir): system(mkdir -p $$dst_dir)
|
||||
|
||||
|
||||
@@ -488,7 +488,7 @@ void MavLinkNode::process()//线程函数
|
||||
while (running_flag)
|
||||
{
|
||||
count ++;
|
||||
QThread::msleep(1000/running_frq);
|
||||
//QThread::msleep(1000/running_frq);
|
||||
//timer->start();
|
||||
|
||||
//解码从UDP来的
|
||||
@@ -498,7 +498,12 @@ void MavLinkNode::process()//线程函数
|
||||
{
|
||||
//qDebug() << "client parse";
|
||||
Mavlinkparse(SourceType::c_sock,datagram);
|
||||
|
||||
QApplication::processEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
//QThread::msleep(1000/running_frq);
|
||||
QThread::yieldCurrentThread();
|
||||
}
|
||||
|
||||
//解码从串口来的
|
||||
@@ -509,7 +514,12 @@ void MavLinkNode::process()//线程函数
|
||||
{
|
||||
//qDebug() << "serial port parse";
|
||||
Mavlinkparse(SourceType::s_port,datagram);
|
||||
|
||||
QApplication::processEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
//QThread::msleep(1000/running_frq);
|
||||
QThread::yieldCurrentThread();
|
||||
}
|
||||
|
||||
if(isInterruptionRequested())//退出
|
||||
@@ -601,6 +611,8 @@ void MavLinkNode::Mavlinkparse(quint32 src,QByteArray datagram)
|
||||
|
||||
hasConneted = true;
|
||||
|
||||
count_in += datagram.size();
|
||||
|
||||
for (QByteArray::const_iterator i = datagram.cbegin(); i != datagram.cend(); ++i)
|
||||
{
|
||||
|
||||
@@ -779,7 +791,10 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
{
|
||||
|
||||
|
||||
_vehicle vehicle = vehicleList.value(msg.sysid);
|
||||
//_vehicle vehicle = vehicleList.value(msg.sysid);
|
||||
|
||||
vehicle.sysid = msg.sysid;
|
||||
vehicle.compid = msg.compid;
|
||||
|
||||
switch (msg.msgid) {
|
||||
case MAVLINK_MSG_ID_AUTOPILOT_VERSION: {
|
||||
@@ -1132,13 +1147,14 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
|
||||
|
||||
|
||||
vehicleList.insert(msg.sysid,vehicle);//直接覆盖
|
||||
|
||||
//vehicleList.insert(msg.sysid,vehicle);//直接覆盖
|
||||
|
||||
|
||||
|
||||
emit signal_vehicle(vehicle);
|
||||
|
||||
//emit state_updated();
|
||||
emit state_updated();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user