添加kb3

This commit is contained in:
hm
2020-10-07 12:24:23 +08:00
parent 6da5821dcb
commit 8e1807c8f2
14 changed files with 341 additions and 104 deletions
@@ -372,7 +372,7 @@ QVariant ParameterInspector::param_value(mavlink_param_value_t param)
}break;
default:
{
value = ((int32_t *)&param.param_value)[0];
value = ((float *)&param.param_value)[0];
//qDebug() << "Unsupported type " << param.param_type;
}break;
@@ -452,8 +452,8 @@ float ParameterInspector::param_getvalue(QVariant param,uint8_t type)
}break;
default:
{
src.i32[0] = param.toUInt();
((int32_t *)&value)[0] = (int32_t)src.i32[0];
src.f[0] = param.toFloat();
((float *)&value)[0] = (float)src.i32[0];
}break;
}
-6
View File
@@ -47,12 +47,6 @@
border-image:url(:/img/sub1_unSelected.png);
}
.QPushButton:hover{
font :20px;
font-weight:bold;
border-image:url(:/img/sub1_Selected.png);
}
.QPushButton[state="2"]{
font :20px;
font-weight:bold;
+164 -18
View File
@@ -6,23 +6,53 @@ PowerSystem::PowerSystem(QWidget *parent) :
ui(new Ui::PowerSystem)
{
ui->setupUi(this);
par = parent;
//load qss
QFile file(":/qss/PowerSystem.qss");
file.open(QFile::ReadOnly);
QTextStream filetext(&file);
QString stylesheet = filetext.readAll();
this->setStyleSheet(stylesheet);
file.close();
//setContextMenuPolicy(Qt::ActionsContextMenu);
//设置label
/*
setColor(ui->label_RS,state::success);
setColor(ui->label_NMS,state::success);
setColor(ui->label_ITP,state::success);
setColor(ui->label_CR,state::success);
setColor(ui->label_ITT,state::success);
setColor(ui->label_RPM_mea,state::success);
setColor(ui->label_RM,state::success);
setColor(ui->label_ATP,state::success);
setColor(ui->label_T5,state::success);
setColor(ui->label_TRPM,state::success);
*/
//ui->checkBox->setCheckable(true);
//ui->checkBox->setChecked(true);
//ui->checkBox->setCheckable(false);
// ui->checkBox->setStyleSheet(
// "QCheckBox::indicator{width: 15px;height: 15px;}QCheckBox::indicator:unchecked {image:url(:/img/normal.png);}QCheckBox::indicator:checked {image:url(:/img/fail.png);}");
//设置灯
setColor(ui->checkBox_1,state::success);
setColor(ui->checkBox_2,state::success);
setColor(ui->checkBox_3,state::success);
setColor(ui->checkBox_4,state::success);
setColor(ui->checkBox_5,state::success);
setColor(ui->checkBox_6,state::success);
setColor(ui->checkBox_7,state::success);
setColor(ui->checkBox_8,state::success);
setColor(ui->checkBox_9,state::success);
setColor(ui->checkBox_10,state::success);
setColor(ui->checkBox_11,state::success);
setColor(ui->checkBox_12,state::success);
setColor(ui->checkBox_13,state::success);
setColor(ui->checkBox_14,state::success);
setColor(ui->checkBox_15,state::success);
setColor(ui->checkBox_16,state::success);
setColor(ui->checkBox_17,state::success);
setColor(ui->checkBox_18,state::success);
setColor(ui->checkBox_19,state::success);
setColor(ui->checkBox_20,state::success);
setColor(ui->checkBox_21,state::success);
ui->comboBox_Full->addItem("基准档",0);
@@ -69,6 +99,11 @@ PowerSystem::~PowerSystem()
delete ui;
}
void PowerSystem::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void PowerSystem::mousePressEvent(QMouseEvent *event)
{
@@ -107,16 +142,127 @@ void PowerSystem::setFloat(void)
else
{
this->setParent(par);
this->move(0,0);
}
this->show();
}
void PowerSystem::setColor(QWidget *w,state s)
{
w->setProperty("state",s);
w->style()->unpolish(w);
w->style()->polish(w);
}
void PowerSystem::setValue(QLabel *w,QString s)
{
w->setText(s);
}
void PowerSystem::setTurbineState(mavlink_turbinestate_t *t)
{
QString runState;
switch (t->SysState & 0x000F) {
case 0x00: runState = "静止"; break;
case 0x01: runState = "地面检查"; break;
case 0x02: runState = "冷运转"; break;
case 0x03: runState = "(预留)"; break;
case 0x04: runState = "停车"; break;
case 0x05: runState = "地起"; break;
case 0x06: runState = "空起(预留)"; break;
case 0x07: runState = "手动"; break;
case 0x08: runState = "安全"; break;
case 0x09: runState = "稳态"; break;
case 0x0a: runState = "减速"; break;
case 0x0b: runState = "加速"; break;
case 0x0c: runState = "关加力"; break;
case 0x0d: runState = "加力点火"; break;
case 0x0e: runState = "半加力"; break;
case 0x0f: runState = "全加力"; break;
default: runState = "静止"; break;
}
setValue(ui->label_RS,runState);
setValue(ui->label_NMS,QString::number(0));
setValue(ui->label_P1t,QString::number(t->P1t));
setValue(ui->label_CR,QString::number(t->P3t/t->P1t));
setValue(ui->label_T1t,QString::number(t->T1t));
setValue(ui->label_RPM_mea,QString::number(t->RPM_mea));
if((t->SysState & 0x0010) > 0)
{
setValue(ui->label_RM,"正式运行");
}
else{
setValue(ui->label_RM,"地面调试");
}
if((t->SysState & 0x0020) > 0)
{
setValue(ui->label_NMS,"N2传感器");
}
else{
setValue(ui->label_NMS,"N1传感器");
}
setValue(ui->label_P5t,QString::number(t->P5t));
setValue(ui->label_T5,QString::number(t->T5));
setValue(ui->label_RPM_des,QString::number(t->RPM_des));
setValue(ui->label_RPM_mea,QString::number(t->RPM_mea));
setValue(ui->label_T5,QString::number(t->T5));
setValue(ui->label_RPM_mea,QString::number(t->Kfuel));
setValue(ui->label_RPM_mea,QString::number(t->RPM_des));
setValue(ui->label_RPM_mea,QString::number(t->RPM_des_ap));
setValue(ui->label_RPM_mea,QString::number(t->stage_ap));
setValue(ui->label_RPM_mea,QString::number(t->temp_ap));
setValue(ui->label_RPM_mea,QString::number(t->tas_ap));
setValue(ui->label_RPM_mea,QString::number(t->asl_ap));
setValue(ui->label_RPM_mea,QString::number(t->KabMain));
setValue(ui->label_RPM_mea,QString::number(t->KabFire));
setValue(ui->label_T5,QString::number(t->KDj));
setValue(ui->label_RPM_mea,QString::number(t->T1t));
setValue(ui->label_RPM_mea,QString::number(t->P1t));
setValue(ui->label_RPM_mea,QString::number(t->P3t));
setValue(ui->label_RPM_mea,QString::number(t->P5t));
setValue(ui->label_RPM_mea,QString::number(t->DJS));
setValue(ui->label_RPM_mea,QString::number(t->Vcc));
setValue(ui->label_RPM_mea,QString::number(t->Tbak));
setValue(ui->label_RPM_mea,QString::number(t->RPM_bak));
setValue(ui->label_RPM_mea,QString::number(t->IOState));
setValue(ui->label_RPM_mea,QString::number(t->SysState));
setValue(ui->label_RPM_mea,QString::number(t->Fault));
setValue(ui->label_RPM_mea,QString::number(t->rev));
setValue(ui->label_RPM_mea,QString::number(t->CFuelMode));
setValue(ui->label_RPM_mea,QString::number(t->Cmd));
setColor(ui->checkBox_1,((t->SysState & 0x0100) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_2,((t->SysState & 0x0200) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_3,((t->SysState & 0x0400) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_4,((t->SysState & 0x0800) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_5,((t->SysState & 0x1000) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_6,((t->SysState & 0x2000) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_7,((t->SysState & 0x4000) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_8,((t->Fault & 0x0001) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_9,((t->Fault & 0x0002) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_10,((t->Fault & 0x0004) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_11,((t->Fault & 0x0008) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_12,((t->Fault & 0x0010) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_13,((t->Fault & 0x0020) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_14,((t->Fault & 0x0040) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_15,((t->Fault & 0x0080) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_16,((t->Fault & 0x0100) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_17,((t->Fault & 0x0200) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_18,((t->Fault & 0x0400) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_19,((t->Fault & 0x0800) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_20,((t->Fault & 0x1000) > 0)?(state::failure):(state::success));
setColor(ui->checkBox_21,((t->Fault & 0x2000) > 0)?(state::failure):(state::success));
}
+18 -2
View File
@@ -7,7 +7,9 @@
#include "QAction"
#include "QContextMenuEvent"
#include "QMenu"
#include "QColor"
#include "QLabel"
#include "mavlink.h"
namespace Ui {
class PowerSystem;
@@ -18,16 +20,30 @@ class PowerSystem : public QWidget
Q_OBJECT
public:
enum state{
success = 0,
failure,
};
explicit PowerSystem(QWidget *parent = nullptr);
~PowerSystem();
void mousePressEvent(QMouseEvent *event);
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void setTurbineState(mavlink_turbinestate_t *t);
private slots:
void setColor(QWidget *w, state s);
void setValue(QLabel *w,QString s);
public slots:
void setFloat(void);
+11 -2
View File
@@ -16,8 +16,17 @@ HEADERS += \
SOURCES += \
$$PWD/PowerSystem.cpp
RESOURCES += \
$$PWD/PowerSystem.qrc
INCLUDEPATH += $$PWD/../mavlink \
$$PWD/../mavlink/ardupilotmega \
$$PWD/../mavlink/common \
$$PWD/../mavlink/icarous \
$$PWD/../mavlink/uAvionix \
$$PWD/../mavlink/XYK \
$$PWD/../mavlink/message_definitions
+9
View File
@@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/qss">
<file>PowerSystem.qss</file>
</qresource>
<qresource prefix="/img">
<file>fail.png</file>
<file>normal.png</file>
</qresource>
</RCC>
+66
View File
@@ -0,0 +1,66 @@
.QFrame {
background-color: #FFFFFF;
}
.QPushButton {
background-color: #FFFFFF /*palegoldenrod*/;
border-width: 2px;
border-color: darkkhaki;
border-style: solid;
border-radius: 5;
padding: 3px;
font: 30px "Arial";
}
.QPushButton:pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #dadbde, stop: 1 #f6f7fa);
}
.QLineEdit {
background-color: #FFFFFF;
font: 30px "Arial";
}
.QLabel {
font: 30px "Arial";
}
.QLabel[state="0"] {
image:url(:/img/normal.png);
}
.QLabel[state="1"] {
image:url(:/img/fail.png);
}
.QComboBox {
background-color: #FFFFFF;
font: 30px "Arial";
}
.QCheckBox{
width: 25px;
height: 25px;
}
.QCheckBox::indicator {
width: 15px;
height: 15px;
}
.QCheckBox::indicator[state="0"] {
image:url(:/img/normal.png);
}
.QCheckBox::indicator[state="1"] {
image:url(:/img/fail.png);
}
+49 -67
View File
@@ -219,9 +219,6 @@
</property>
<item row="4" column="3">
<widget class="QLabel" name="label_T5">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string/>
</property>
@@ -243,9 +240,6 @@
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_RS">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string/>
</property>
@@ -274,19 +268,13 @@
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_RM">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_TRPM">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<widget class="QLabel" name="label_RPM_des">
<property name="text">
<string/>
</property>
@@ -300,10 +288,7 @@
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_ATP">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<widget class="QLabel" name="label_P5t">
<property name="text">
<string/>
</property>
@@ -318,19 +303,13 @@
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_NMS">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_ITP">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<widget class="QLabel" name="label_P1t">
<property name="text">
<string/>
</property>
@@ -338,29 +317,20 @@
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_CR">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 0, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_ITT">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<widget class="QLabel" name="label_T1t">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_RPM">
<property name="styleSheet">
<string notr="true">background-color: rgb(85, 170, 0);</string>
</property>
<widget class="QLabel" name="label_RPM_mea">
<property name="text">
<string/>
</property>
@@ -403,42 +373,42 @@
<number>10</number>
</property>
<item row="6" column="1">
<widget class="QLabel" name="label_SK">
<widget class="QLabel" name="label_KDj">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_SEVOR">
<widget class="QLabel" name="label_DJS">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_FK">
<widget class="QLabel" name="label_Kfuel">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_H">
<widget class="QLabel" name="label_asl_ap">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -450,12 +420,12 @@
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_OTP">
<widget class="QLabel" name="label_P3t">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -467,32 +437,32 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_PP">
<widget class="QLabel" name="label_CFuelMode">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_AUXRPM">
<widget class="QLabel" name="label_RPM_bak">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLabel" name="label_POWER">
<widget class="QLabel" name="label_Vcc">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -504,12 +474,12 @@
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLabel" name="label_RCMD">
<widget class="QLabel" name="label_Cmd">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -528,12 +498,12 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_ACCM">
<widget class="QLabel" name="label_stage_ap">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -545,12 +515,12 @@
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_RET">
<widget class="QLabel" name="label_temp_ap">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -567,7 +537,7 @@
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -579,32 +549,32 @@
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_RRPM">
<widget class="QLabel" name="label_RPM_des_ap">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="label_EABBK">
<widget class="QLabel" name="label_KabFire">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_EABK">
<widget class="QLabel" name="label_KabMain">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -637,12 +607,12 @@
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_RH">
<widget class="QLabel" name="label_tas_ap">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -683,7 +653,7 @@
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
<string>0</string>
</property>
</widget>
</item>
@@ -716,6 +686,12 @@
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>告警状态</string>
</property>
@@ -810,6 +786,12 @@
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>故障状态</string>
</property>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+6 -4
View File
@@ -816,10 +816,6 @@ void MainWindow::updateUI()//事件驱动式更新数据
}
//设置舵机显示
int ServoPort = 0;
@@ -844,6 +840,12 @@ void MainWindow::updateUI()//事件驱动式更新数据
servos[15] = dlink->mavlinknode->vehicle.servo_output_raw.servo16_raw;
toolsui->index4->setChannel(ServoPort,servos);
toolsui->powersystem->setTurbineState(&dlink->mavlinknode->vehicle.turbinstate);
}
void MainWindow::TotalDistance(double value)
+9 -1
View File
@@ -546,7 +546,15 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
case MAVLINK_MSG_ID_VFR_HUD: {
mavlink_msg_vfr_hud_decode(&msg,&vehicle.vfr_hud);
}break;
case MAVLINK_MSG_ID_TurbineState: {
mavlink_msg_turbinestate_decode(&msg,&vehicle.turbinstate);
}break;
case MAVLINK_MSG_ID_BMUState: {
mavlink_msg_bmustate_decode(&msg,&vehicle.bmustate);
}break;
case MAVLINK_MSG_ID_CCMState: {
mavlink_msg_ccmstate_decode(&msg,&vehicle.ccmstate);
}break;
}
emit state_updated();
+5
View File
@@ -51,6 +51,11 @@ class MavLinkNode : public QObject
mavlink_vibration_t vibration;
mavlink_enginestate_t enginestate;
mavlink_vfr_hud_t vfr_hud;
mavlink_turbinestate_t turbinstate;
mavlink_bmustate_t bmustate;
mavlink_ccmstate_t ccmstate;
}_vehicle;
public:
+1 -1
Submodule mavlink updated: 438e824241...54c7286a2c