修复转发bug

This commit is contained in:
2024-09-19 10:12:11 +08:00
parent e6127300a4
commit a5fc50e704
3 changed files with 17 additions and 9 deletions
+9 -5
View File
@@ -241,12 +241,11 @@ MavLinkNode::MavLinkNode(QObject *parent) : ThreadTemplet(parent)
m_heartbeat.type = 0;
connect(&showInfoTimer, &QTimer::timeout, this, [this]()
{
infoExport(info);
});
showInfoTimer = new QTimer;
showInfoTimer->setInterval(200);
connect(showInfoTimer, &QTimer::timeout, this, &MavLinkNode::showInfoTimerTimeout, Qt::DirectConnection);
showInfoTimer.start(200);
showInfoTimer->start();
}
MavLinkNode::~MavLinkNode()
@@ -2069,6 +2068,11 @@ void MavLinkNode::heartbeat(uint32_t custom_mode,uint8_t type,uint8_t autopilot,
Send(msg);
}
void MavLinkNode::showInfoTimerTimeout()
{
infoExport(info);
}
void MavLinkNode::Transmit(QString msg)
{
+5 -1
View File
@@ -24,6 +24,7 @@
#include "ParsePack.h"
#include "QTime"
#include "QDateTime"
#include <QTimer>
#ifdef QtMavlinkNode
#include <mavlinknodeglobal.h>
@@ -356,8 +357,11 @@ protected:
QDateTime *gpstimebase = nullptr;
_showinfo info;
QTimer showInfoTimer;
QPointer<QTimer> showInfoTimer = nullptr;
private slots:
void showInfoTimerTimeout();
};
#endif // MAVLINKNODE_H
+3 -3
View File
@@ -1,4 +1,4 @@
#include "dlink.h"
#include "dlink.h"
#include <string.h>
#include "QDateTime"
#include "QElapsedTimer"
@@ -13,10 +13,10 @@ DLink::DLink(QObject *parent) : QObject(parent)
//在当前线程运行
connect(mavlinknode,SIGNAL(SendMessageTo(quint8,quint8*,quint16)),
this,SLOT(SendMessageTo(quint8,quint8*,quint16)),Qt::BlockingQueuedConnection);//BlockingQueuedConnection);//信号和槽必须在不同的线程中,否则就产生死锁
this,SLOT(SendMessageTo(quint8,quint8*,quint16)));//BlockingQueuedConnection);//信号和槽必须在不同的线程中,否则就产生死锁
connect(mavlinknode,SIGNAL(SendMessageToExport(quint8,quint8*,quint16)),
this,SLOT(SendMessageToExport(quint8,quint8*,quint16)),Qt::BlockingQueuedConnection);//BlockingQueuedConnection);//信号和槽必须在不同的线程中,否则就产生死锁
this,SLOT(SendMessageToExport(quint8,quint8*,quint16)));//BlockingQueuedConnection);//信号和槽必须在不同的线程中,否则就产生死锁
//在当前线程运行