修改健康字

This commit is contained in:
hm
2020-12-25 22:12:40 +08:00
parent 6a1b1ed5ae
commit a9cf7f4117
3 changed files with 299 additions and 190 deletions
+32 -32
View File
@@ -98,64 +98,64 @@ void HealthUI::setState(uint32_t pos,state sta)
break;
case 6:
//setColor(ui->label_6,sta);
setColor(ui->label_6,sta);
break;
case 7:
//setColor(ui->label_7,sta);
setColor(ui->label_7,sta);
break;
case 8:
//setColor(ui->label_8,sta);
setColor(ui->label_8,sta);
break;
case 9:
//setColor(ui->label_9,sta);
setColor(ui->label_9,sta);
break;
case 10:
//setColor(ui->label_10,sta);
break;
case 11:
//setColor(ui->label_11,sta);
setColor(ui->label_11,sta);
break;
case 12:
//setColor(ui->label_12,sta);
setColor(ui->label_12,sta);
break;
case 13:
//setColor(ui->label_13,sta);
setColor(ui->label_13,sta);
break;
case 14:
//setColor(ui->label_14,sta);
setColor(ui->label_14,sta);
break;
case 15:
//setColor(ui->label_15,sta);
break;
case 16:
//setColor(ui->label_16,sta);
setColor(ui->label_16,sta);
break;
case 17:
//setColor(ui->label_17,sta);
setColor(ui->label_17,sta);
break;
case 18:
//setColor(ui->label_18,sta);
setColor(ui->label_18,sta);
break;
case 19:
//setColor(ui->label_19,sta);
setColor(ui->label_19,sta);
break;
case 20:
//setColor(ui->label_20,sta);
break;
case 21:
//setColor(ui->label_21,sta);
setColor(ui->label_21,sta);
break;
case 22:
//setColor(ui->label_22,sta);
setColor(ui->label_22,sta);
break;
case 23:
//setColor(ui->label_23,sta);
setColor(ui->label_23,sta);
break;
case 24:
//setColor(ui->label_24,sta);
setColor(ui->label_24,sta);
break;
case 25:
//setColor(ui->label_25,sta);
@@ -201,64 +201,64 @@ void HealthUI::setValueState(uint32_t pos,QVariant sta)
break;
case 6:
//setValue(ui->label_6,sta.toString());
setValue(ui->label_6,sta.toString());
break;
case 7:
//setValue(ui->label_7,sta.toString());
setValue(ui->label_7,sta.toString());
break;
case 8:
//setValue(ui->label_8,sta.toString());
setValue(ui->label_8,sta.toString());
break;
case 9:
//setValue(ui->label_9,sta.toString());
setValue(ui->label_9,sta.toString());
break;
case 10:
//setValue(ui->label_10,sta.toString());
break;
case 11:
//setValue(ui->label_11,sta.toString());
setValue(ui->label_11,sta.toString());
break;
case 12:
//setValue(ui->label_12,sta.toString());
setValue(ui->label_12,sta.toString());
break;
case 13:
//setValue(ui->label_13,sta.toString());
setValue(ui->label_13,sta.toString());
break;
case 14:
//setValue(ui->label_14,sta.toString());
setValue(ui->label_14,sta.toString());
break;
case 15:
//setValue(ui->label_15,sta.toString());
break;
case 16:
//setValue(ui->label_16,sta.toString());
setValue(ui->label_16,sta.toString());
break;
case 17:
//setValue(ui->label_17,sta.toString());
setValue(ui->label_17,sta.toString());
break;
case 18:
//setValue(ui->label_18,sta.toString());
setValue(ui->label_18,sta.toString());
break;
case 19:
//setValue(ui->label_19,sta.toString());
setValue(ui->label_19,sta.toString());
break;
case 20:
//setValue(ui->label_20,sta.toString());
break;
case 21:
//setValue(ui->label_21,sta.toString());
setValue(ui->label_21,sta.toString());
break;
case 22:
//setValue(ui->label_22,sta.toString());
setValue(ui->label_22,sta.toString());
break;
case 23:
//setValue(ui->label_23,sta.toString());
setValue(ui->label_23,sta.toString());
break;
case 24:
//setValue(ui->label_24,sta.toString());
setValue(ui->label_24,sta.toString());
break;
case 25:
//setValue(ui->label_25,sta.toString());
+242 -10
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>378</width>
<height>101</height>
<height>199</height>
</rect>
</property>
<property name="windowTitle">
@@ -80,26 +80,71 @@
<property name="spacing">
<number>5</number>
</property>
<item row="0" column="3">
<widget class="QLabel" name="label_4">
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>记录打开</string>
<string>起落架</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<item row="4" column="2">
<widget class="QLabel" name="label_23">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>SBG</string>
<string>侧滑角状态</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_22">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>静压状态</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_21">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>动压状态</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_24">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>迎角状态</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -128,13 +173,26 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>起落架</string>
<string>SBG</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_4">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>大气机</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -143,6 +201,180 @@
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_5">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>PWM模块</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>遥控器</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_7">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>数据上行</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_19">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>前轮载</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_18">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>右轮载</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_17">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>左轮载</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_16">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>轮转状态</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_14">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>起落架放到位</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_13">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>起落架收到位</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_12">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>刹车</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>开伞</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_8">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>记录打开</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
+25 -148
View File
@@ -814,7 +814,7 @@ void MainWindow::setCommunicationLostState(bool flag)
isCommunicationLost = flag;
healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
//healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
if(flag == true)//通讯丢失
{
@@ -1320,162 +1320,39 @@ void MainWindow::updateUI()//事件驱动式更新数据
healthui->setState(1,getBit(health,2)?(getBit(health,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//IMU
healthui->setState(2,getBit(health,3)?(getBit(health,1)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//SBG
healthui->setState(3,getBit(health,6)?(getBit(health,5)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//GEAR
healthui->setState(4,getBit(health,7)?(HealthUI::state::success):(HealthUI::state::failure));//RECORD
healthui->setState(5,getBit(health,4)?(HealthUI::state::success):(HealthUI::state::failure));//SEL
healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
// 22 23 24 25 26 27 28 29
// 5525D 5803A 5607A 4525D atteck slide 解码 通讯
healthui->setState(7,getBit(health,29)?(getBit(health,28)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//AIR
healthui->setState(8,getBit(health,5)?(getBit(health,11)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//FL
healthui->setState(4,getBit(health,9)?(getBit(health,8)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//SBG
healthui->setState(5,getBit(health,11)?(getBit(health,10)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//起落架
healthui->setState(6,getBit(health,12)?(HealthUI::state::success):(HealthUI::state::failure));//
healthui->setState(7,getBit(health,13)?(HealthUI::state::success):(HealthUI::state::failure));//DLINK
healthui->setState(8,getBit(health,7)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
toolsui->servosystem->setCheckState(6,getBit(health,22)?(HealthUI::state::failure):(HealthUI::state::success));
toolsui->servosystem->setCheckState(7,getBit(health,23)?(HealthUI::state::failure):(HealthUI::state::success));
toolsui->servosystem->setCheckState(8,getBit(health,24)?(HealthUI::state::failure):(HealthUI::state::success));
toolsui->servosystem->setCheckState(9,getBit(health,25)?(HealthUI::state::failure):(HealthUI::state::success));
toolsui->servosystem->setCheckState(10,getBit(health,26)?(HealthUI::state::failure):(HealthUI::state::success));
toolsui->servosystem->setCheckState(11,getBit(health,27)?(HealthUI::state::failure):(HealthUI::state::success));
/*
qDebug() << getBit(health,22)
<< getBit(health,23)
<< getBit(health,24)
<< getBit(health,25)
<< getBit(health,26)
<< getBit(health,27);
*/
/*
sbus = feedback (ra)
sbus = feedback (re)
sbus = feedback (ru)
sbus = feedback (la)
15 sbus = feedback (le)
health = 0 le la ru re ra //顺序和上面sbus一样
GBIT zero SBIT
*/
//舵机反馈是有符号16b/
//qDebug() << getBit(health,16);
uint16_t servoHealt = dlink->mavlinknode->vehicle.servo_output_raw.servo10_raw;
healthui->setState(11,getBit(health,16)?(getBit(servoHealt,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LA
healthui->setState(12,getBit(health,13)?(getBit(servoHealt,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RA
healthui->setState(13,getBit(health,17)?(getBit(servoHealt,4)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LE
healthui->setState(14,getBit(health,14)?(getBit(servoHealt,1)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RE
healthui->setState(15,getBit(health,15)?(getBit(servoHealt,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RU
healthui->setState(9,getBit(health,4)?(HealthUI::state::success):(HealthUI::state::warning));//DLINK
healthui->setValueState(9,getBit(health,4)?(tr("连接SBG"))(tr("连接内置")));//sel
//healthui->setState(10,getBit(health,5)?(getBit(health,11)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//FL
//19~24
healthui->setState(11,getBit(health,14)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
healthui->setState(12,getBit(health,15)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
healthui->setState(13,getBit(health,16)?(HealthUI::state::success):(HealthUI::state::inital));//起落架到位
healthui->setState(14,getBit(health,17)?(HealthUI::state::success):(HealthUI::state::inital));//起落架到位
//healthui->setState(15,getBit(health,15)?(getBit(servoHealt,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RU
if(((dlink->mavlinknode->vehicle.turbinstate.SysState & 0x000F) == 0x04) ||
((dlink->mavlinknode->vehicle.turbinstate.SysState & 0x000F) == 0x00))
{
healthui->setState(21,HealthUI::state::failure);//停车
}
else
{
healthui->setState(21,HealthUI::state::inital);//停车
}
//healthui->setState(21,((dlink->mavlinknode->vehicle.turbinstate.SysState & 0x000F) == 0x04)?(HealthUI::state::failure):(HealthUI::state::inital));//停车
healthui->setState(22,getBit(health,18)?(HealthUI::state::failure):(HealthUI::state::inital));//开伞
healthui->setState(23,getBit(health,19)?(HealthUI::state::failure):(HealthUI::state::inital));//开气囊
healthui->setState(24,getBit(health,20)?(HealthUI::state::failure):(HealthUI::state::inital));//充气
healthui->setState(25,getBit(health,21)?(HealthUI::state::failure):(HealthUI::state::inital));//抛伞
//healthui->setState(26,((dlink->mavlinknode->vehicle.turbinstate.SysState & 0x000F) >= 0x0d)?(HealthUI::state::success):(HealthUI::state::inital));//开加力
if((dlink->mavlinknode->vehicle.turbinstate.SysState & 0x000F) >= 0x0d)
{
uint8_t sta = dlink->mavlinknode->vehicle.turbinstate.SysState & 0x000F;
switch (sta) {
case 0x0d:
healthui->setValueState(26,tr("开加力"));
break;
case 0x0e:
healthui->setValueState(26,tr("半加力"));
break;
case 0x0f:
healthui->setValueState(26,tr("全加力"));
break;
default:
healthui->setValueState(26,tr("关加力"));
break;
}
healthui->setState(26,HealthUI::state::success);//开加力
}
else
{
healthui->setState(26,HealthUI::state::inital);//开加力
healthui->setValueState(26,tr("关加力"));
}
//healthui->setState(26,(((dlink->mavlinknode->vehicle.servo_output_raw.servo6_raw - 1000)/10) > 110)?(HealthUI::state::success):(HealthUI::state::inital));//开加力
switch (dlink->mavlinknode->vehicle.ins1.sys_status & 0x0F) {
default:
case 0:
{
healthui->setState(9,HealthUI::state::success);
healthui->setValueState(9,tr("INS解算正常"));
}break;
case 1:
{
healthui->setState(9,HealthUI::state::failure);
healthui->setValueState(9,tr("INS星数不足"));
}break;
case 2:
{
healthui->setState(9,HealthUI::state::failure);
healthui->setValueState(9,tr("INS内部错误"));
}break;
case 3:
{
healthui->setState(9,HealthUI::state::failure);
healthui->setValueState(9,tr("INS速度超限"));
}break;
}
switch (dlink->mavlinknode->vehicle.ins2.sys_status & 0x0F) {
default:
case 0:
{
healthui->setState(10,HealthUI::state::success);
healthui->setValueState(10,tr("SBG解算正常"));
}break;
case 1:
{
healthui->setState(10,HealthUI::state::failure);
healthui->setValueState(10,tr("SBG星数不足"));
}break;
case 2:
{
healthui->setState(10,HealthUI::state::failure);
healthui->setValueState(10,tr("SBG内部错误"));
}break;
case 3:
{
healthui->setState(10,HealthUI::state::failure);
healthui->setValueState(10,tr("SBG速度超限"));
}break;
}
healthui->setState(16,getBit(health,18)?(HealthUI::state::success):(HealthUI::state::failure));//DLINK
healthui->setState(17,getBit(health,19)?(HealthUI::state::success):(HealthUI::state::failure));//DLINK
healthui->setState(18,getBit(health,20)?(HealthUI::state::success):(HealthUI::state::failure));//DLINK
healthui->setState(19,getBit(health,21)?(HealthUI::state::success):(HealthUI::state::failure));//DLINK
healthui->setState(28,getBit(health,31)?(HealthUI::state::inital):(HealthUI::state::failure));
healthui->setState(29,getBit(health,30)?(HealthUI::state::success):(HealthUI::state::inital));
//healthui->setValueState(29,getBit(health,30)?(tr("记录已打开")):(tr("")));//sel
healthui->setState(21,getBit(health,22)?(HealthUI::state::success):(HealthUI::state::failure));//开伞
healthui->setState(22,getBit(health,23)?(HealthUI::state::success):(HealthUI::state::failure));//开气囊
healthui->setState(23,getBit(health,24)?(HealthUI::state::success):(HealthUI::state::failure));//充气
healthui->setState(24,getBit(health,25)?(HealthUI::state::success):(HealthUI::state::failure));//抛伞
healthui->setState(30,getBit(health,12)?(HealthUI::state::warning):(HealthUI::state::success));//sel
healthui->setValueState(30,getBit(health,12)?(tr("连接内置惯导")):(tr("连接SBG")));//sel
@@ -1584,7 +1461,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
statusui->setEngine(1,QString::number((dlink->mavlinknode->vehicle.servo_output_raw.servo6_raw - 1000) * 0.1,'f',0),
statusui->setEngine(1,QString::number(dlink->mavlinknode->vehicle.vfr_hud.throttle,'f',0),
QString::number(dlink->mavlinknode->vehicle.turbinstate.RPM_mea,'f',0));
statusui->setEngine(2,QString::number(dlink->mavlinknode->vehicle.ccmstate.fuel_level * 10.0 / 65536.0f,'f',1),