This commit is contained in:
hm
2021-05-29 11:56:43 +08:00
parent 26a77b16ba
commit 0010e2055b
6 changed files with 100 additions and 153 deletions
+6 -5
View File
@@ -29,17 +29,18 @@ HealthUI::HealthUI(QWidget *parent) :
Install("记录打开",7,state::inital);
Install("外置记录",8,state::inital);//1,绿,2,黄
Install("正在写入",9,state::inital);//3
Install("大气机",10,state::inital);
Install("开伞",11,state::inital);//12
Install("气囊充气",12,state::inital);//11
Install("切伞",13,state::inital);
Install("MS5525",14,state::inital);
Install("MS5803",15,state::inital);
//Install("迎角",19,state::inital);
//Install("侧滑角",20,state::inital);
Install("大气机",16,state::inital);
Install("总压",17,state::inital);
Install("静压",18,state::inital);
Install("迎角",19,state::inital);
Install("侧滑角",20,state::inital);
//通过json安装
+8 -35
View File
@@ -84,18 +84,16 @@ void MenuBarUI::setPushButtonState(uint8_t state1,uint8_t state2,uint8_t state3,
ui->pushButton_Mission->style()->unpolish(ui->pushButton_Mission);
ui->pushButton_Mission->style()->polish(ui->pushButton_Mission);
ui->pushButton_Flight->setProperty("state",state4);
ui->pushButton_Flight->style()->unpolish(ui->pushButton_Flight);
ui->pushButton_Flight->style()->polish(ui->pushButton_Flight);
ui->pushButton_Base->setProperty("state",state4);
ui->pushButton_Base->style()->unpolish(ui->pushButton_Base);
ui->pushButton_Base->style()->polish(ui->pushButton_Base);
ui->pushButton_Info->setProperty("state",state5);
ui->pushButton_Info->style()->unpolish(ui->pushButton_Info);
ui->pushButton_Info->style()->polish(ui->pushButton_Info);
ui->pushButton_Base->setProperty("state",state6);
ui->pushButton_Base->style()->unpolish(ui->pushButton_Base);
ui->pushButton_Base->style()->polish(ui->pushButton_Base);
}
@@ -153,22 +151,8 @@ void MenuBarUI::on_pushButton_Mission_clicked()
emit IndexChanged(CurrentIndex);
}
void MenuBarUI::on_pushButton_Flight_clicked()
void MenuBarUI::on_pushButton_Base_clicked()
{
/*
if(CurrentIndex == 3)
{
CurrentIndex = 5;
ui->pushButton_Flight->setText(tr("Base"));
}
else
{
CurrentIndex = 3;
ui->pushButton_Flight->setText(tr("Flight"));
}
*/
CurrentIndex = 3;
setPushButtonState(state::unSelected,
@@ -177,12 +161,14 @@ void MenuBarUI::on_pushButton_Flight_clicked()
state::Selected,
state::unSelected,
state::unSelected);
update();
emit IndexChanged(CurrentIndex);
}
void MenuBarUI::on_pushButton_Info_clicked()
{
{
CurrentIndex = 4;
setPushButtonState(state::unSelected,
@@ -191,24 +177,11 @@ void MenuBarUI::on_pushButton_Info_clicked()
state::unSelected,
state::Selected,
state::unSelected);
update();
emit IndexChanged(CurrentIndex);
}
void MenuBarUI::on_pushButton_Base_clicked()
{
CurrentIndex = 5;
setPushButtonState(state::unSelected,
state::unSelected,
state::unSelected,
state::unSelected,
state::unSelected,
state::Selected);
update();
emit IndexChanged(CurrentIndex);
}
void MenuBarUI::showMessage(const QString &message, int TimeOut)
-2
View File
@@ -74,8 +74,6 @@ private slots:
void on_pushButton_Mission_clicked();
void on_pushButton_Flight_clicked();
void on_pushButton_Info_clicked();
+44 -63
View File
@@ -40,25 +40,6 @@
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_Flight">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Flight</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Mission">
<property name="minimumSize">
@@ -84,50 +65,6 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pushButton_Info">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Tools</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Setting">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Setting</string>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_SelfTest">
<property name="minimumSize">
@@ -148,6 +85,25 @@
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_Info">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Tools</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_Base">
<property name="minimumSize">
<size>
@@ -166,6 +122,31 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Setting">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Setting</string>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
+3
View File
@@ -2,6 +2,9 @@
#include "ui_ToolsUI.h"
//消息通过广播和监听处理
ToolsUI::ToolsUI(QWidget *parent) :
QWidget(parent),
ui(new Ui::ToolsUI)
+39 -48
View File
@@ -869,55 +869,33 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
missionUI->hide();
}
if((index == 2)||(index == 3)||(index == 5)) map->show();
if((index == 2)||(index == 3)) map->show();
else map->hide();
//飞行
//状态
if(index == 3)
{
copk->show();
commandUI->show();
//statusui->show();
statusui->show();
healthui->show();
}
else
{
copk->hide();
commandUI->hide();
//statusui->hide();
statusui->hide();
healthui->hide();
}
//信息
//工具
if(index == 4) toolsui->show();
else toolsui->hide();
if(index == 5)
{
if(statusui->isHidden())
{
copk->show();
commandUI->show();
statusui->show();
healthui->show();
}
else
{
copk->show();
commandUI->show();
statusui->hide();
healthui->show();
}
}
else
{
statusui->hide();
}
resizeEvent(nullptr);
}
@@ -1020,7 +998,7 @@ void MainWindow::setServoOffset(QVariant la,QVariant ra,
}
QString ch1,ch2,ch3,ch4;
void MainWindow::update_servo_output_raw(mavlink_servo_output_raw_t servo)
{
servos.clear();
@@ -1042,24 +1020,41 @@ void MainWindow::update_servo_output_raw(mavlink_servo_output_raw_t servo)
servos.insert(16,servo.servo16_raw);
toolsui->index4->setChannel(servo.port,servos);
if(servo.port == 0)
{
//12-16
statusui->setValue(2,0,QString::number(((int16_t)servo.servo13_raw) * 38.0 / 32767.0,'f',2));//8000H~7FFFH -38°~38° 1LSB=38/32767
statusui->setValue(2,1,QString::number(((int16_t)servo.servo14_raw) * 88.0 / 32767.0,'f',2));//88/32767
statusui->setValue(2,2,QString::number(((int16_t)servo.servo15_raw) * 22.5 / 32767.0,'f',2));//直线舵机
statusui->setValue(2,3,QString::number(((int16_t)servo.servo16_raw) * 22.5 / 32767.0,'f',2));
statusui->setValue(2,0,QString::number(((int16_t)servo.servo1_raw) * 38.0 / 32767.0,'f',2) + '|'
+ QString::number(((int16_t)servo.servo13_raw) * 38.0 / 32767.0,'f',2));//8000H~7FFFH -38°~38° 1LSB=38/32767
statusui->setValue(2,1,QString::number(((int16_t)servo.servo2_raw) * 88.0 / 32767.0,'f',2) + '|'
+ QString::number(((int16_t)servo.servo14_raw) * 88.0 / 32767.0,'f',2));//88/32767
statusui->setValue(2,2,QString::number(((int16_t)servo.servo3_raw) * 22.5 / 32767.0,'f',2) + '|'
+ QString::number(((int16_t)servo.servo15_raw) * 22.5 / 32767.0,'f',2));//直线舵机
statusui->setValue(2,3,QString::number(((int16_t)servo.servo4_raw) * 22.5 / 32767.0,'f',2) + '|'
+ QString::number(((int16_t)servo.servo16_raw) * 22.5 / 32767.0,'f',2));
ch1 = QString::number(((int16_t)servo.servo5_raw) * 38.0 / 32767.0,'f',2);
ch2 = QString::number(((int16_t)servo.servo6_raw) * 88.0 / 32767.0,'f',2);
ch3 = QString::number(((int16_t)servo.servo7_raw) * 22.5 / 32767.0,'f',2);
ch4 = QString::number(((int16_t)servo.servo8_raw) * 22.5 / 32767.0,'f',2);
}
else if(servo.port == 1)
{
//17-19
statusui->setValue(2,4,QString::number(((int16_t)servo.servo1_raw) * 38.0 / 32767.0,'f',2));
statusui->setValue(2,5,QString::number(((int16_t)servo.servo2_raw) * 88.0 / 32767.0,'f',2));
statusui->setValue(2,6,QString::number(((int16_t)servo.servo3_raw) * 22.5 / 32767.0,'f',2));
statusui->setValue(2,7,QString::number(((int16_t)servo.servo4_raw) * 22.5 / 32767.0,'f',2));
statusui->setValue(2,4,ch1 + '|' + QString::number(((int16_t)servo.servo1_raw) * 38.0 / 32767.0,'f',2));
statusui->setValue(2,5,ch2 + '|' + QString::number(((int16_t)servo.servo2_raw) * 88.0 / 32767.0,'f',2));
statusui->setValue(2,6,ch3 + '|' + QString::number(((int16_t)servo.servo3_raw) * 22.5 / 32767.0,'f',2));
statusui->setValue(2,7,ch4 + '|' + QString::number(((int16_t)servo.servo4_raw) * 22.5 / 32767.0,'f',2));
}
@@ -1402,16 +1397,18 @@ void MainWindow::updateUI()//事件驱动式更新数据
healthui->setColor(8,getBit(enabled,1)?(getBit(enabled,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//record
healthui->setColor(9,getBit(enabled,2)?(HealthUI::state::success):(HealthUI::state::inital));//正在记录,未记录
healthui->setValue(9,getBit(enabled,2)?(tr("正在写入")):(tr("停止写入")));//sel
healthui->setColor(10,getBit(health,8)?(getBit(health,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//大气机
//healthui->setColor(10,getBit(health,8)?(getBit(health,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//大气机
healthui->setColor(11,getBit(health,16)?(HealthUI::state::failure):(HealthUI::state::inital));//气囊充气
healthui->setColor(12,getBit(health,17)?(HealthUI::state::failure):(HealthUI::state::inital));//开伞
healthui->setColor(13,getBit(health,18)?(HealthUI::state::failure):(HealthUI::state::inital));//切伞
healthui->setColor(14,getBit(health,22)?(HealthUI::state::success):(HealthUI::state::failure));//MS5525
healthui->setColor(15,getBit(health,23)?(HealthUI::state::success):(HealthUI::state::failure));//MS5803
//healthui->setColor(19,getBit(health,26)?(HealthUI::state::success):(HealthUI::state::failure));//迎角
//healthui->setColor(20,getBit(health,27)?(HealthUI::state::success):(HealthUI::state::failure));//侧滑角
healthui->setColor(16,getBit(health,8)?(getBit(health,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//大气机
healthui->setColor(17,getBit(health,22)?(HealthUI::state::success):(HealthUI::state::failure));//MS5525
healthui->setColor(18,getBit(health,23)?(HealthUI::state::success):(HealthUI::state::failure));//MS5803
healthui->setColor(19,getBit(health,26)?(HealthUI::state::success):(HealthUI::state::failure));//迎角
healthui->setColor(20,getBit(health,27)?(HealthUI::state::success):(HealthUI::state::failure));//侧滑角
}
@@ -1514,12 +1511,6 @@ void MainWindow::updateUI()//事件驱动式更新数据
statusui->setValue(5,1,QString::number(dlink->mavlinknode->vehicleList.value(currentUAV).battery_status.voltages[2] * 0.001,'f',1));
//========================6
QString Fix;
switch (dlink->mavlinknode->vehicleList.value(currentUAV).gps_raw_int.fix_type) {
case 0: