修改指令界面
This commit is contained in:
@@ -68,8 +68,6 @@ CommandBox::CommandBox(QWidget *parent) :
|
||||
ui->comboBox_TestValue->setCurrentIndex(-1);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
CommandBox::~CommandBox()
|
||||
@@ -181,8 +179,72 @@ void CommandBox::on_comboBox_TestPoint_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
//二次确认
|
||||
void CommandBox::setSecondConfirm(QVariant value)
|
||||
{
|
||||
if(value.toBool() == true)
|
||||
{
|
||||
emit cmd_long(m_param1,m_param2,m_param3,m_param4,m_param5,m_param6,m_param7,m_command,m_confirm);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_param1 = 0;
|
||||
m_param2 = 0;
|
||||
m_param3 = 0;
|
||||
m_param4 = 0;
|
||||
m_param5 = 0;
|
||||
m_param6 = 0;
|
||||
m_param7 = 0;
|
||||
m_command = 0;
|
||||
m_confirm = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_SendCommand_clicked()
|
||||
{
|
||||
emit cmd_long(m_param1,m_param2,m_param3,m_param4,m_param5,m_param6,m_param7,m_command,m_confirm);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Cancel_clicked()
|
||||
{
|
||||
m_param1 = 0;
|
||||
m_param2 = 0;
|
||||
m_param3 = 0;
|
||||
m_param4 = 0;
|
||||
m_param5 = 0;
|
||||
m_param6 = 0;
|
||||
m_param7 = 0;
|
||||
m_command = 0;
|
||||
m_confirm = 0;
|
||||
}
|
||||
|
||||
|
||||
void CommandBox::on_commandClicked(QString name,
|
||||
float param1,float param2,float param3,float param4,
|
||||
float param5,float param6,float param7,
|
||||
uint16_t command,uint8_t confirmation)
|
||||
{
|
||||
|
||||
m_name = name;
|
||||
m_param1 = param1;
|
||||
m_param2 = param2;
|
||||
m_param3 = param3;
|
||||
m_param4 = param4;
|
||||
m_param5 = param5;
|
||||
m_param6 = param6;
|
||||
m_param7 = param7;
|
||||
m_command = command;
|
||||
m_confirm = confirmation;
|
||||
|
||||
ui->lineEdit_CommandName->setText(name);
|
||||
}
|
||||
|
||||
|
||||
//测试指令
|
||||
void CommandBox::on_pushButton_SendTest_clicked()
|
||||
{
|
||||
//判断 两个 内容是否是空,
|
||||
|
||||
float testPoint = 0;
|
||||
float testValue = 0;
|
||||
|
||||
@@ -196,10 +258,113 @@ void CommandBox::on_pushButton_SendTest_clicked()
|
||||
testPoint = ui->comboBox_TestPoint->currentData(Qt::UserRole).toFloat();
|
||||
}
|
||||
|
||||
qDebug() << "send test:" << testPoint << testValue;
|
||||
|
||||
on_commandClicked(ui->comboBox_TestPoint->currentText() + " " + ui->comboBox_TestValue->currentText() ,
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//伺服指令
|
||||
|
||||
void CommandBox::on_pushButton_AirHeatOn_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_AirHeatOn->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_AirHeatOff_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_AirHeatOff->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
|
||||
//舵机指令
|
||||
void CommandBox::on_pushButton_Servo_Check_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Servo_Check->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Servo_Read_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Servo_Read->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Servo_Zero_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Servo_Zero->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Servo_Work_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Servo_Work->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
|
||||
void CommandBox::on_pushButton_coldrun_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_coldrun->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_groundstartup_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_groundstartup->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Afterburner_off_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Afterburner_off->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_stop_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_stop->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_EmergencyStop_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_EmergencyStop->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Hardware_off_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Hardware_off->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Hardware_on_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Hardware_on->text(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Afterburner_on_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Afterburner_on->text() + " " + ui->comboBox_Full->currentText(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_Afterburner_half_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_Afterburner_half->text() + " " + ui->comboBox_Half->currentText(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_setRPM_clicked()
|
||||
{
|
||||
on_commandClicked(ui->pushButton_setRPM->text() + " " + ui->comboBox_rate->currentText(),
|
||||
102,0,0,0,0,0,0,180,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
#include "QContextMenuEvent"
|
||||
#include "QMenu"
|
||||
|
||||
|
||||
#include "multiselector.h"
|
||||
#include "Selector.h"
|
||||
#include "Inputter.h"
|
||||
#include "CharInputter.h"
|
||||
#include "Confirm.h"
|
||||
#include "CommandEditor.h"
|
||||
|
||||
namespace Ui {
|
||||
class CommandBox;
|
||||
}
|
||||
@@ -32,6 +40,55 @@ public slots:
|
||||
void on_comboBox_TestPoint_currentIndexChanged(int index);
|
||||
void on_pushButton_SendTest_clicked();
|
||||
|
||||
void setSecondConfirm(QVariant value);
|
||||
void on_commandClicked(QString name,
|
||||
float param1, float param2, float param3, float param4,
|
||||
float param5, float param6, float param7,
|
||||
uint16_t command, uint8_t confirmation);
|
||||
|
||||
signals:
|
||||
|
||||
void cmd_int(float param1, float param2, float param3, float param4, int x, int y, float z);
|
||||
void cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
|
||||
|
||||
|
||||
private slots:
|
||||
void on_pushButton_Servo_Check_clicked();
|
||||
|
||||
void on_pushButton_Servo_Read_clicked();
|
||||
|
||||
void on_pushButton_Servo_Zero_clicked();
|
||||
|
||||
void on_pushButton_Servo_Work_clicked();
|
||||
|
||||
void on_pushButton_AirHeatOn_clicked();
|
||||
|
||||
void on_pushButton_AirHeatOff_clicked();
|
||||
|
||||
void on_pushButton_coldrun_clicked();
|
||||
|
||||
void on_pushButton_groundstartup_clicked();
|
||||
|
||||
void on_pushButton_Afterburner_off_clicked();
|
||||
|
||||
void on_pushButton_stop_clicked();
|
||||
|
||||
void on_pushButton_EmergencyStop_clicked();
|
||||
|
||||
void on_pushButton_Hardware_off_clicked();
|
||||
|
||||
void on_pushButton_Hardware_on_clicked();
|
||||
|
||||
void on_pushButton_Afterburner_on_clicked();
|
||||
|
||||
void on_pushButton_Afterburner_half_clicked();
|
||||
|
||||
void on_pushButton_setRPM_clicked();
|
||||
|
||||
void on_pushButton_SendCommand_clicked();
|
||||
|
||||
void on_pushButton_Cancel_clicked();
|
||||
|
||||
private:
|
||||
|
||||
QWidget *m_parent;
|
||||
@@ -39,6 +96,20 @@ private:
|
||||
bool floatflag = true;
|
||||
|
||||
Ui::CommandBox *ui;
|
||||
|
||||
|
||||
QString m_name = 0;
|
||||
float m_param1 = 0;
|
||||
float m_param2 = 0;
|
||||
float m_param3 = 0;
|
||||
float m_param4 = 0;
|
||||
float m_param5 = 0;
|
||||
float m_param6 = 0;
|
||||
float m_param7 = 0;
|
||||
uint16_t m_command = 10;
|
||||
uint8_t m_confirm = 10;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // COMMANDBOX_H
|
||||
|
||||
@@ -11,6 +11,8 @@ INCLUDEPATH += $$PWD/../ComponentUI/CharInputter
|
||||
INCLUDEPATH += $$PWD/../ComponentUI/Inputter
|
||||
INCLUDEPATH += $$PWD/../ComponentUI/MultiSelector
|
||||
INCLUDEPATH += $$PWD/../ComponentUI/Selector
|
||||
INCLUDEPATH += $$PWD/../ComponentUI/Confirm
|
||||
INCLUDEPATH += $$PWD/../ComponentUI/CommandEditor
|
||||
|
||||
|
||||
|
||||
|
||||
+282
-205
@@ -6,149 +6,263 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>358</width>
|
||||
<height>461</height>
|
||||
<width>710</width>
|
||||
<height>465</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>发动机指令</string>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>待发指令</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_CommandName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_SendCommand">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>发送</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Cancel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>控制指令</string>
|
||||
<string>发动机指令</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_coldrun">
|
||||
<property name="text">
|
||||
<string>冷运转</string>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>控制指令</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButton_groundstartup">
|
||||
<property name="text">
|
||||
<string>地面启动</string>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_coldrun">
|
||||
<property name="text">
|
||||
<string>冷运转</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButton_groundstartup">
|
||||
<property name="text">
|
||||
<string>地面启动</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_55">
|
||||
<property name="text">
|
||||
<string>全加力档</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Full"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Afterburner_on">
|
||||
<property name="text">
|
||||
<string>全加力</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pushButton_Afterburner_off">
|
||||
<property name="text">
|
||||
<string>关全加力</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_56">
|
||||
<property name="text">
|
||||
<string>半加力档</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Half"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Afterburner_half">
|
||||
<property name="text">
|
||||
<string>半加力</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="pushButton_stop">
|
||||
<property name="text">
|
||||
<string>停车</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>给定转速</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBox_rate"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pushButton_setRPM">
|
||||
<property name="text">
|
||||
<string>给定转速</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="pushButton_EmergencyStop">
|
||||
<property name="text">
|
||||
<string>紧急停车</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Hardware_on">
|
||||
<property name="text">
|
||||
<string>硬件停车开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="pushButton_Hardware_off">
|
||||
<property name="text">
|
||||
<string>硬件停车关</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_55">
|
||||
<property name="text">
|
||||
<string>全加力档</string>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Full"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Afterburner_on">
|
||||
<property name="text">
|
||||
<string>全加力</string>
|
||||
<property name="title">
|
||||
<string>测试指令</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pushButton_Afterburner_off">
|
||||
<property name="text">
|
||||
<string>关全加力</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_56">
|
||||
<property name="text">
|
||||
<string>半加力档</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Half"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Afterburner_half">
|
||||
<property name="text">
|
||||
<string>半加力</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="pushButton_stop">
|
||||
<property name="text">
|
||||
<string>停车</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>给定转速</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBox_rate"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pushButton_setRPM">
|
||||
<property name="text">
|
||||
<string>给定转速</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="pushButton_EmergencyStop">
|
||||
<property name="text">
|
||||
<string>紧急停车</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Hardware_on">
|
||||
<property name="text">
|
||||
<string>硬件停车开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="pushButton_Hardware_off">
|
||||
<property name="text">
|
||||
<string>硬件停车关</string>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_TestPoint"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QFrame" name="framex">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_SendTest">
|
||||
<property name="text">
|
||||
<string>测试</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_58">
|
||||
<property name="text">
|
||||
<string>测试项</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_TestValue">
|
||||
<property name="text">
|
||||
<string>测试值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_TestValue"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>测试指令</string>
|
||||
<string>伺服指令</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_TestPoint"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="3">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@@ -157,111 +271,74 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_SendTest">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_AirHeatOff">
|
||||
<property name="text">
|
||||
<string>测试</string>
|
||||
<string>空速加热关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_TestValue"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_58">
|
||||
<widget class="QPushButton" name="pushButton_AirHeatOn">
|
||||
<property name="text">
|
||||
<string>测试项</string>
|
||||
<string>空速加热打开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_TestValue">
|
||||
<property name="text">
|
||||
<string>测试值</string>
|
||||
<item row="0" column="2">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>伺服指令</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_56V_On">
|
||||
<property name="text">
|
||||
<string>56V供电打开</string>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>舵机指令</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Check">
|
||||
<property name="text">
|
||||
<string>上电自检</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Read">
|
||||
<property name="text">
|
||||
<string>舵面找零</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Zero">
|
||||
<property name="text">
|
||||
<string>地面自检 </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Work">
|
||||
<property name="text">
|
||||
<string>工作模式</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_56V_Off">
|
||||
<property name="text">
|
||||
<string>56V供电关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_AirHeatOn">
|
||||
<property name="text">
|
||||
<string>空速加热打开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_AirHeatOff">
|
||||
<property name="text">
|
||||
<string>空速加热关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>舵机指令</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Check">
|
||||
<property name="text">
|
||||
<string>上电自检</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Read">
|
||||
<property name="text">
|
||||
<string>舵面找零</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Zero">
|
||||
<property name="text">
|
||||
<string>地面自检 </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Servo_Work">
|
||||
<property name="text">
|
||||
<string>工作模式</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -398,7 +398,6 @@ void CommandUI::setSecondConfirm(QVariant value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CommandUI::on_commandClicked()
|
||||
{
|
||||
//找到消息的发送者
|
||||
|
||||
+62
-2
@@ -112,6 +112,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(dlink->mavlinknode,SIGNAL(beep()),
|
||||
this,SLOT(beep()),Qt::DirectConnection);
|
||||
|
||||
connect(dlink->mavlinknode,SIGNAL(CommuniationLost(bool)),
|
||||
this,SLOT(setCommunicationLostState(bool)),Qt::DirectConnection);
|
||||
|
||||
|
||||
//this ----- map
|
||||
connect(map,SIGNAL(TotalDistanceUpdate(double)),
|
||||
this,SLOT(TotalDistance(double)));
|
||||
@@ -630,7 +634,29 @@ void MainWindow::beep(void)
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setCommunicationLostState(bool flag)
|
||||
{
|
||||
static bool last = false;
|
||||
|
||||
healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(1):(0));//DLINK
|
||||
|
||||
if(flag == true)//通讯丢失
|
||||
{
|
||||
if(last != flag)
|
||||
{
|
||||
tts->say(tr("Communication Lost"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(last != flag)
|
||||
{
|
||||
tts->say(tr("Communication Regain"));
|
||||
}
|
||||
}
|
||||
|
||||
last = flag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -830,7 +856,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
mode_str.append(tr("AUTO_FOLLOW_TARGET"));
|
||||
break;
|
||||
default:
|
||||
mode_str.append(tr("unsported"));
|
||||
//mode_str.append(tr("unsported"));
|
||||
break;
|
||||
}
|
||||
copk->setMode(mode_str);
|
||||
@@ -939,7 +965,8 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
healthui->setState(3,getBit(health,9)?(getBit(health,3)?(0):(2)):(1));//ECU
|
||||
healthui->setState(5,getBit(health,10)?(getBit(health,4)?(0):(2)):(1));//CCM
|
||||
|
||||
healthui->setState(6,getBit(health,(dlink->mavlinknode->isCommunicationLost)?(1):(0)));//DLINK
|
||||
//qDebug() << dlink->mavlinknode->isCommunicationLost;
|
||||
//healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(1):(0));//DLINK
|
||||
|
||||
healthui->setState(7,getBit(health,13));//AIR
|
||||
healthui->setState(8,getBit(health,14));//record
|
||||
@@ -965,6 +992,39 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
healthui->setState(26,getBit(health,12)?(2):(0));//sel
|
||||
healthui->setValueState(26,getBit(health,12)?(tr("连接内置惯导")):(tr("连接SBG")));//sel
|
||||
|
||||
|
||||
|
||||
statusui->setState(1,1,2);
|
||||
statusui->setState(2,QString::number(dlink->mavlinknode->vehicle.attitude.pitch * 57.3,'f',1),2);
|
||||
statusui->setState(3,QString::number(dlink->mavlinknode->vehicle.attitude.roll * 57.3,'f',1),2);
|
||||
statusui->setState(4,QString::number(dlink->mavlinknode->vehicle.attitude.yaw * 57.3,'f',1),2);
|
||||
statusui->setState(5,QString::number(dlink->mavlinknode->vehicle.nav_controller_output.xtrack_error,'f',1),2);
|
||||
statusui->setState(6,QString::number(dlink->mavlinknode->vehicle.gps_raw_int.alt,'f',1),2);
|
||||
statusui->setState(7,QString::number(dlink->mavlinknode->vehicle.vfr_hud.airspeed,'f',1),2);
|
||||
statusui->setState(8,QString::number(dlink->mavlinknode->vehicle.vfr_hud.airspeed,'f',1),2);
|
||||
statusui->setState(9,QString::number(dlink->mavlinknode->vehicle.vfr_hud.airspeed/340.0,'f',1),2);
|
||||
statusui->setState(10,QString::number(dlink->mavlinknode->vehicle.vfr_hud.climb,'f',1),2);
|
||||
|
||||
statusui->setServo(1,1,1);
|
||||
statusui->setServo(2,1,1);
|
||||
statusui->setServo(3,1,1);
|
||||
statusui->setServo(4,1,1);
|
||||
statusui->setServo(5,1,1);
|
||||
|
||||
statusui->setEngine(1,1);
|
||||
statusui->setEngine(2,1);
|
||||
statusui->setEngine(3,1);
|
||||
statusui->setEngine(4,1);
|
||||
statusui->setEngine(5,1);
|
||||
statusui->setEngine(6,1);
|
||||
|
||||
statusui->setBattery(1,1);
|
||||
statusui->setBattery(2,1);
|
||||
statusui->setBattery(3,1);
|
||||
statusui->setBattery(4,1);
|
||||
|
||||
statusui->setDlink(1,1);
|
||||
statusui->setDlink(2,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ public:
|
||||
public slots:
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
void setCommunicationLostState(bool flag);
|
||||
|
||||
void beep(void);
|
||||
|
||||
|
||||
@@ -28,18 +28,17 @@ MavLinkNode::MavLinkNode(QObject *parent) : QObject(parent)
|
||||
int Current_sysID = 0xFB;
|
||||
int Current_CompID = MAV_COMP_ID_MISSIONPLANNER;
|
||||
|
||||
CommucationOverTimer = 5000;
|
||||
|
||||
CommucationOverTimer = 1000;
|
||||
|
||||
timer = new QTimer(this);
|
||||
timer->moveToThread(thread);
|
||||
//timer->moveToThread(thread);
|
||||
timer->setInterval(CommucationOverTimer);
|
||||
|
||||
connect(thread, SIGNAL(started()), timer, SLOT(start()));
|
||||
//connect(thread, SIGNAL(started()), timer, SLOT(start()));
|
||||
connect(timer,SIGNAL(timeout()),
|
||||
this,SLOT(TimerOut,Qt::DirectConnection));
|
||||
this,SLOT(TimerOut()),Qt::DirectConnection);
|
||||
|
||||
//timer->start();
|
||||
timer->start();
|
||||
|
||||
qDebug() << "start timer";
|
||||
|
||||
@@ -240,6 +239,8 @@ void MavLinkNode::process()//线程函数
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t count = 0;
|
||||
QByteArray datagram = nullptr;
|
||||
while (running_flag)
|
||||
@@ -276,8 +277,20 @@ void MavLinkNode::process()//线程函数
|
||||
|
||||
void MavLinkNode::TimerOut(void)
|
||||
{
|
||||
isCommunicationLost = true;
|
||||
qDebug() << "timeout" << "communication lost";
|
||||
CommucationOverCount --;
|
||||
|
||||
if(CommucationOverCount <= 0)
|
||||
{
|
||||
CommucationOverCount = 0;
|
||||
isCommunicationLost = true;
|
||||
//qDebug() << "timeout" << "communication lost";
|
||||
|
||||
emit CommuniationLost(isCommunicationLost);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit CommuniationLost(isCommunicationLost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -396,8 +409,11 @@ void MavLinkNode::Mavlinkparse(quint32 src,QByteArray datagram)
|
||||
if(msg.sysid < 250) //过滤地面站发过来的数据
|
||||
{
|
||||
//timer->start();
|
||||
isCommunicationLost = true;
|
||||
|
||||
CommucationOverCount = 5;
|
||||
isCommunicationLost = false;
|
||||
|
||||
//emit CommuniationLost(isCommunicationLost);
|
||||
|
||||
MAVLinkRcv_Handler(msg); //接收完一帧数据并处理
|
||||
emit recievemsg(msg); //将信息广播出去
|
||||
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
bool isCommunicationLost = false;
|
||||
|
||||
signals:
|
||||
void CommuniationLost(bool);
|
||||
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
void beep(void);
|
||||
@@ -150,6 +152,7 @@ protected:
|
||||
s_port = 1
|
||||
};
|
||||
|
||||
int32_t CommucationOverCount = 5;
|
||||
uint64_t CommucationOverTimer = 5000;
|
||||
|
||||
uint8_t GCS_System_ID = 0xFF;
|
||||
|
||||
Reference in New Issue
Block a user