发动机界面数据修改

This commit is contained in:
hm
2020-12-13 11:00:31 +08:00
parent 6e074e1988
commit 5f294c6996
5 changed files with 57 additions and 35 deletions
+11 -7
View File
@@ -230,13 +230,17 @@ void PowerSystem::setTurbineState(mavlink_turbinestate_t *t)
}
setValue(ui->label_RS,runState);
float cr = 0;
if(t->P1t != 0)
{
//setValue(ui->label_CR,QString::number((t->P3t*10.0)/t->P1t,'f',3));
cr = ((float)t->P5t * 1.0f)/t->P1t;
setValue(ui->label_CR,QString::number(cr,'f',3));
}
else
{
//setValue(ui->label_CR,QString::number(0));
cr = 0;
setValue(ui->label_CR,QString::number(0));
}
if(t->SysState & 0x0010)
@@ -271,7 +275,7 @@ void PowerSystem::setTurbineState(mavlink_turbinestate_t *t)
setValue(ui->label_KDj,QString::number(t->KDj*30.0,'f',1));
setValue(ui->label_T1t,QString::number(t->T1t + 200 - 273.15,'f',1));
setValue(ui->label_P1t,QString::number(t->P1t,'f',1));
//setValue(ui->label_CR,QString::number(((float)t->P5t)/t->P1t,'f',1));
setValue(ui->label_DJS,QString::number(t->DJS / 4.0,'f',1));
setValue(ui->label_Vcc,QString::number(t->Vcc / 5.0,'f',1));
@@ -323,13 +327,13 @@ void PowerSystem::setTurbineState(mavlink_turbinestate_t *t)
ScopeRPM->setSerieData(tr("物理转速"),t->RPM_mea);
ScopeRPM->setSerieData(tr("期望物理转速"),t->RPM_des);
ScopeRPM->setSerieData(tr("物理"),t->RPM_mea);
ScopeRPM->setSerieData(tr("期望"),t->RPM_des);
ScopeTemp->setSerieData(tr("排气温度T5"),t->T5 * 0.1 - 273.15);
ScopeTemp->setSerieData(tr("压比"),cr);
//从新做一个函数
ScopeAlt->setSerieData(tr("海拔"),t->asl_ap*100.0);
ScopeAlt->setSerieData(tr("Wf测"),t->P3t);
//ScopeMa->setSerieData(tr("马赫"),t->tas_ap);
+4 -4
View File
@@ -55,7 +55,7 @@
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
<string notr="true">background-color: rgb(170, 255, 127);</string>
</property>
<property name="text">
<string/>
@@ -173,7 +173,7 @@
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
<string notr="true">background-color: rgb(170, 255, 127);</string>
</property>
<property name="text">
<string/>
@@ -218,7 +218,7 @@
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
<string notr="true">background-color: rgb(170, 255, 127);</string>
</property>
<property name="text">
<string/>
@@ -256,7 +256,7 @@
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
<string notr="true">background-color: rgb(170, 255, 127);</string>
</property>
<property name="text">
<string/>
+1 -1
View File
@@ -1721,7 +1721,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
toolsui->diagram->setBattery(8,QString::number((int16_t)dlink->mavlinknode->vehicle.bmustate.BAT2_low_temp_degC,'f',1));
toolsui->diagram->setDlink(1,QString::number(dlink->mavlinknode->rssi,'f',0));
toolsui->diagram->setDlink(2,QString::number(dlink->mavlinknode->bitrate));
toolsui->diagram->setDlink(2,QString::number(dlink->mavlinknode->rate_in));
//dlink->mavlinknode->vehicle.turbinstate.RPM_mea = 12000;
+27 -20
View File
@@ -41,7 +41,13 @@ MavLinkNode::MavLinkNode(QObject *parent) : QObject(parent)
this,&MavLinkNode::TimerOut,Qt::DirectConnection);
timer->start();
qDebug() << "start timer";
timer_1s = new QTimer();
timer_1s->setInterval(1000);
connect(timer_1s,&QTimer::timeout,
this,&MavLinkNode::timer_1s_Out,Qt::DirectConnection);
timer_1s->start();
hasConneted = false;
//comm
@@ -412,7 +418,7 @@ void MavLinkNode::TimerOut(void)
}
emit updateDlink(rssi,bitrate);
emit updateDlink(rssi,rate_in);
}
void MavLinkNode::LogTimerOut(void)
@@ -431,8 +437,25 @@ void MavLinkNode::LogTimerOut(void)
}
}
void MavLinkNode::timer_1s_Out(void)
{
static qint64 last = QDateTime::currentMSecsSinceEpoch();
qint64 time = QDateTime::currentMSecsSinceEpoch() - last;
if(time >= 2000)
{
rate_in = count_in / (time * 0.001);
bittotal += count_in;
count_in = 0;
last = QDateTime::currentMSecsSinceEpoch();
}
}
void MavLinkNode::initbuff(void)
{
client_buff.max_size = 10 * 1024 *1024;//10M
@@ -448,24 +471,7 @@ void MavLinkNode::initbuff(void)
void MavLinkNode::setbuff(quint32 src,QByteArray data)
{
static qint64 last = QDateTime::currentMSecsSinceEpoch();
bitcount += data.size();
if((QDateTime::currentMSecsSinceEpoch() - last) >= 1000)
{
bitrate = bitcount;
bittotal += bitcount;
bitcount = 0;
last = QDateTime::currentMSecsSinceEpoch();
}
count_in += data.size();
switch (src) {
default:
@@ -493,6 +499,7 @@ void MavLinkNode::setbuff(quint32 src,QByteArray data)
QByteArray MavLinkNode::readbuff(quint32 src)
{
QByteArray datagram;
switch (src) {
+14 -3
View File
@@ -81,8 +81,14 @@ public:
bool isCommunicationLost = false;
uint64_t bitrate = 0;
uint64_t bitcount = 0;
uint64_t rate_in = 0;
uint64_t count_in = 0;
uint64_t rate_out = 0;
uint64_t count_out = 0;
uint64_t bittotal = 0;
uint64_t parserSuccess = 0;
@@ -152,7 +158,7 @@ private slots:
void TimerOut(void);
void LogTimerOut(void);
void timer_1s_Out(void);
//解析
void Mavlinkparse(quint32 src,QByteArray datagram);
@@ -203,6 +209,11 @@ protected:
QTimer *logTimer = nullptr;
QTimer *timer_1s = nullptr;
};
#endif // MAVLINKNODE_H