使用GPS时间作为基准
This commit is contained in:
@@ -446,7 +446,7 @@ void PowerSystem::setFuel(QVariant press, QVariant value)
|
||||
|
||||
|
||||
|
||||
void PowerSystem::setMa(QVariant Ma)
|
||||
void PowerSystem::setMa(qint64 time, QVariant Ma)
|
||||
{
|
||||
if(AMaTimer)
|
||||
{
|
||||
@@ -456,9 +456,8 @@ void PowerSystem::setMa(QVariant Ma)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
averageMa.append(Ma.toDouble());
|
||||
averageTime.append(QDateTime::currentMSecsSinceEpoch());
|
||||
averageTime.append(time);
|
||||
|
||||
while(averageTime.back() - averageTime.first() > (100 * 1000))
|
||||
{
|
||||
|
||||
@@ -59,10 +59,7 @@ public:
|
||||
void setTurbineState(mavlink_turbinestate_t *t);
|
||||
void setCCMState(mavlink_ccmstate_t *t);
|
||||
|
||||
void setMa(QVariant Ma);
|
||||
void setAlt(QVariant Alt);
|
||||
|
||||
void setFuel(QVariant press,QVariant value);
|
||||
|
||||
void updateUI();
|
||||
|
||||
@@ -82,6 +79,11 @@ private slots:
|
||||
public slots:
|
||||
void setFloat(void);
|
||||
|
||||
void setMa(qint64 time, QVariant Ma);
|
||||
void setAlt(QVariant Alt);
|
||||
|
||||
void setFuel(QVariant press,QVariant value);
|
||||
|
||||
|
||||
private:
|
||||
QTimer timer2;
|
||||
|
||||
+10
-2
@@ -1,4 +1,4 @@
|
||||
#include "mainwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include "QPushButton"
|
||||
#include "QAction"
|
||||
|
||||
@@ -275,6 +275,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
|
||||
|
||||
//dlink ----toolsui-power
|
||||
|
||||
//toolsui->powersystem->setMa(vehicle.timebase,vehicle.emb_atom_com.mach);
|
||||
|
||||
connect(dlink->mavlinknode,SIGNAL(setMa(qint64,QVariant)),
|
||||
toolsui->powersystem,SLOT(setMa(qint64,QVariant)));
|
||||
|
||||
|
||||
|
||||
//setting ----- map
|
||||
connect(setting->index0->globalsetting,SIGNAL(getMapTypes()),
|
||||
@@ -1545,7 +1553,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
toolsui->powersystem->setTurbineState(&vehicle.turbinstate);
|
||||
toolsui->powersystem->setCCMState(&vehicle.ccmstate);
|
||||
|
||||
toolsui->powersystem->setMa(vehicle.emb_atom_com.mach);
|
||||
//toolsui->powersystem->setMa(vehicle.timebase,vehicle.emb_atom_com.mach);
|
||||
toolsui->powersystem->setAlt(vehicle.gps_raw_int.alt * 10e-4);
|
||||
|
||||
|
||||
|
||||
@@ -1318,6 +1318,21 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
gpsTimer.min = min;
|
||||
gpsTimer.sec = sec;
|
||||
|
||||
|
||||
if(!gpstimebase)
|
||||
{
|
||||
gpstimebase = new QDateTime();
|
||||
}
|
||||
|
||||
gpstimebase->setDate(QDate(year,mon,day));
|
||||
gpstimebase->setTime(QTime(hour,min,sec));
|
||||
|
||||
vehicle.timebase = gpstimebase->currentMSecsSinceEpoch();
|
||||
|
||||
//qDebug() << gpstimebase->currentMSecsSinceEpoch();
|
||||
|
||||
|
||||
|
||||
_showinfo info;
|
||||
|
||||
info.flag = 0x24a8;
|
||||
@@ -1417,6 +1432,18 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
gpsTimer.min = min;
|
||||
gpsTimer.sec = sec;
|
||||
|
||||
if(!gpstimebase)
|
||||
{
|
||||
gpstimebase = new QDateTime();
|
||||
}
|
||||
|
||||
gpstimebase->setDate(QDate(year,mon,day));
|
||||
gpstimebase->setTime(QTime(hour,min,sec));
|
||||
|
||||
vehicle.timebase = gpstimebase->currentMSecsSinceEpoch();
|
||||
|
||||
//qDebug() << gpstimebase->currentMSecsSinceEpoch();
|
||||
|
||||
_showinfo info;
|
||||
|
||||
|
||||
@@ -1812,6 +1839,9 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
|
||||
setFileData(emb_atom_com_file,csvdata);
|
||||
|
||||
|
||||
emit setMa(vehicle.timebase, vehicle.emb_atom_com.mach);
|
||||
|
||||
}break;
|
||||
case MAVLINK_MSG_ID_TurbineState: {
|
||||
mavlink_msg_turbinestate_decode(&msg,&vehicle.turbinstate);
|
||||
|
||||
@@ -52,6 +52,9 @@ public:
|
||||
int sysid = 0; /* ID of message sender system/aircraft */
|
||||
int compid = 0; /* ID of the message sender component */
|
||||
|
||||
qint64 timebase;
|
||||
|
||||
|
||||
mavlink_autopilot_version_t autopilot_version = {0};
|
||||
mavlink_sys_status_t sys_status = {0};
|
||||
mavlink_heartbeat_t heartbeat = {0};
|
||||
@@ -172,6 +175,8 @@ public:
|
||||
int infoExportID = 1;
|
||||
signals:
|
||||
|
||||
void setMa(qint64 time, QVariant Ma);
|
||||
|
||||
void signal_autopilot_version(mavlink_autopilot_version_t);
|
||||
void signal_sys_status(mavlink_sys_status_t);
|
||||
void signal_heartbeat(mavlink_heartbeat_t);
|
||||
@@ -348,7 +353,7 @@ protected:
|
||||
|
||||
bool use_ins1 = false;
|
||||
|
||||
|
||||
QDateTime *gpstimebase = nullptr;
|
||||
};
|
||||
|
||||
#endif // MAVLINKNODE_H
|
||||
|
||||
Reference in New Issue
Block a user