modify dc output
This commit is contained in:
parent
340f9316ee
commit
71cc0c4f1a
@ -23,6 +23,7 @@ SOURCES += \
|
||||
macconfig.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
mqtt_config.cpp \
|
||||
pointname.cpp \
|
||||
pressure_pulsation.cpp \
|
||||
radial_vibration.cpp \
|
||||
@ -57,6 +58,7 @@ HEADERS += \
|
||||
keyphase_data.h \
|
||||
macconfig.h \
|
||||
mainwindow.h \
|
||||
mqtt_config.h \
|
||||
pointname.h \
|
||||
pressure_pulsation.h \
|
||||
radial_vibration.h \
|
||||
@ -85,6 +87,7 @@ FORMS += \
|
||||
keyphase.ui \
|
||||
macconfig.ui \
|
||||
mainwindow.ui \
|
||||
mqtt_config.ui \
|
||||
pointname.ui \
|
||||
pressure_pulsation.ui \
|
||||
radial_vibration.ui \
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QFile>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
@ -133,9 +133,16 @@ void Acceleration::on_pushButton_confirm_clicked() {
|
||||
qCritical() << "[Acceleration::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibAcc;
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibAcc) {
|
||||
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibAcc || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
@ -218,7 +225,7 @@ void Acceleration::on_pushButton_confirm_clicked() {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
@ -298,3 +305,17 @@ void Acceleration::on_pushButton_cancel_clicked() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void Acceleration::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Acceleration::on_lineEdit_danger_high_level_editingFinished()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,11 @@ class Acceleration : public QWidget {
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
void on_lineEdit_danger_high_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::Acceleration *ui;
|
||||
|
||||
void Init();
|
||||
|
102
acceleration.ui
102
acceleration.ui
@ -412,7 +412,7 @@
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>200</x>
|
||||
<y>150</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -422,37 +422,10 @@
|
||||
<string>整流器</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_rectifier_funtion">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>125</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>200</x>
|
||||
<y>50</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -467,19 +440,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -517,7 +490,7 @@
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>200</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -532,19 +505,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -559,6 +532,63 @@
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_rectifier_funtion">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
|
@ -8,6 +8,10 @@
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
#define SLOT_NUM 15
|
||||
#define CHANNEL_COUNT 4
|
||||
#define RELAY_COUNT 16
|
||||
|
||||
typedef struct {
|
||||
bool used[4]; // 是否已配置
|
||||
int channel;
|
||||
@ -15,10 +19,8 @@ typedef struct {
|
||||
|
||||
extern QString g_strServerIp; // 服务端IP
|
||||
extern QString g_version;
|
||||
extern ChannelUsed ch_used[22];
|
||||
#define SLOT_NUM 15
|
||||
#define CHANNEL_COUNT 4
|
||||
#define RELAY_COUNT 16
|
||||
extern ChannelUsed ch_used[SLOT_NUM][22];
|
||||
|
||||
struct ExprNode {
|
||||
QString value;
|
||||
QList<ExprNode*> children;
|
||||
@ -147,6 +149,31 @@ typedef enum{
|
||||
kUnit13 = 13 // user defined
|
||||
} EngineeringUnit;
|
||||
|
||||
typedef enum{
|
||||
kCh1Output1 = 0, // 通道1 输出1
|
||||
kCh2Output2 = 1, // 通道2 输出1
|
||||
kCh3Output3 = 2, // 通道3 输出1
|
||||
kCh4Output4 = 3, // 通道4 输出1
|
||||
kCh1Ch2 = 4, // 通道1 & 通道2
|
||||
kCh3Ch4 = 5, // 通道3 & 通道4
|
||||
kCh1FreBand1 = 6, // 通道1 分频段1
|
||||
kCh1FreBand2 = 7, // 通道1 分频段2
|
||||
kCh1FreBand3 = 8, // 通道1 分频段3
|
||||
kCh1FreBand4 = 9, // 通道1 分频段4
|
||||
kCh2FreBand1 = 10, // 通道2 分频段1
|
||||
kCh2FreBand2 = 11, // 通道2 分频段2
|
||||
kCh2FreBand3 = 12, // 通道2 分频段3
|
||||
kCh2FreBand4 = 13, // 通道2 分频段4
|
||||
kCh3FreBand1 = 14, // 通道3 分频段1
|
||||
kCh3FreBand2 = 15, // 通道3 分频段2
|
||||
kCh3FreBand3 = 16, // 通道3 分频段3
|
||||
kCh3FreBand4 = 17, // 通道3 分频段4
|
||||
kCh4FreBand1 = 18, // 通道4 分频段1
|
||||
kCh4FreBand2 = 19, // 通道4 分频段2
|
||||
kCh4FreBand3 = 20, // 通道4 分频段3
|
||||
kCh4FreBand4 = 21 // 通道4 分频段4
|
||||
} DCOutputChannel;
|
||||
|
||||
typedef struct SlotConfig_{
|
||||
int slot;
|
||||
QString slot_type;
|
||||
@ -181,10 +208,14 @@ enum CMTCommand {
|
||||
kRebootCard = 21, // 重启板卡
|
||||
kGetCardDcValue = 22, // 获取子板平均值
|
||||
kGetRelayStatus = 23, // 获取继电器状态
|
||||
KConfigProgress = 25,
|
||||
kTimingCmd = 26,
|
||||
kGetTimeInfo = 27,
|
||||
kGetLogInfo = 28
|
||||
kGetKeyphaseInfo = 24, // 获取键相信息
|
||||
kConfigProgress = 25, // 配置进度
|
||||
kTimingCmd = 26, // 校时
|
||||
kGetTimeInfo = 27, // 获取时间信息
|
||||
kGetLogInfo = 28, // 获取子板日志信息
|
||||
kCleanSubCardCfg = 29, // 清理子板配置
|
||||
kCleanSubCardLatch = 30, // 清理子板特定通道的Latch状态
|
||||
kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息
|
||||
};
|
||||
enum RS485Baudrate {
|
||||
kBaudrate2400 = 0,
|
||||
@ -719,6 +750,34 @@ typedef struct {
|
||||
uint32_t ts; // 时间戳
|
||||
} GetTimeInfoRsp;
|
||||
|
||||
typedef struct {
|
||||
uint8_t head[3]; // 固定值:0xAA55AA
|
||||
uint8_t cmd; // kConfigMQTTBrokerInfo
|
||||
uint8_t version; // 版本号,默认为1
|
||||
uint8_t sub_cmd; // 0: get, 1: set
|
||||
char ip[16]; // mqtt broker地址
|
||||
uint16_t port;
|
||||
} MQTTBrokerConfigInfoReq;
|
||||
|
||||
typedef struct {
|
||||
uint8_t head[3]; // 固定值:0xAA55AA
|
||||
uint8_t cmd; // kConfigMQTTBrokerInfo
|
||||
uint8_t version; // 版本号,默认为1
|
||||
uint8_t code; // success:0, failure: others
|
||||
uint8_t sub_cmd; // 0: get, 1: set
|
||||
char ip[16]; // mqtt broker地址
|
||||
uint16_t port;
|
||||
} MQTTBrokerConfigInfoRsp;
|
||||
|
||||
// 子命令无响应,可观察灯板变化
|
||||
typedef struct {
|
||||
uint8_t head[3]; // 固定值:0xAA55AA
|
||||
uint8_t cmd; // kCleanSubCardLatch
|
||||
uint8_t version; // 版本号,默认为1
|
||||
uint8_t card_id; // 子板编号,1-15
|
||||
uint8_t sid; // 通道编号,1-4
|
||||
} CleanLatchStatusReq;
|
||||
|
||||
struct BaseHeader {
|
||||
uint8_t head[3]; // 固定 0xAA 0x55 0xAA
|
||||
uint8_t cmd;
|
||||
|
@ -5,13 +5,14 @@
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
DC_Output_Channel::DC_Output_Channel(QString unit_str_,int current_index_,QWidget *parent) :
|
||||
DC_Output_Channel::DC_Output_Channel(int slot_no_,QString unit_str_,int current_index_,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DC_Output_Channel)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
unit_str = unit_str_;
|
||||
current_index = current_index_;
|
||||
slot_no = slot_no_;
|
||||
ui->label_min_unit->setText(unit_str);
|
||||
ui->label_max_unit->setText(unit_str);
|
||||
radiobtn[0] = ui->radioButton;
|
||||
@ -22,13 +23,13 @@ DC_Output_Channel::DC_Output_Channel(QString unit_str_,int current_index_,QWidge
|
||||
int not_used = 0;
|
||||
for (int i = 0; i < 22; i++) {
|
||||
for (int j = 0; j < 4; j++){
|
||||
if(ch_used[i].used[j] && current_index == i){
|
||||
if(ch_used[slot_no][i].used[j] && current_index == i){
|
||||
radiobtn[j]->setEnabled(true);
|
||||
radiobtn[j]->setChecked(true);
|
||||
first_used = j;
|
||||
}else if(ch_used[i].used[j] && current_index != i){
|
||||
}else if(ch_used[slot_no][i].used[j] && current_index != i){
|
||||
radiobtn[j]->setEnabled(false);
|
||||
}else if(!ch_used[i].used[j] && current_index == i){
|
||||
}else if(!ch_used[slot_no][i].used[j] && current_index == i){
|
||||
not_used ++;
|
||||
}
|
||||
}
|
||||
@ -60,7 +61,7 @@ void DC_Output_Channel::on_pushButton_confirm_clicked()
|
||||
}else if(ui->radioButton_4->isChecked()){
|
||||
channel = 4;
|
||||
}else if(ui->radioButton_5->isChecked()){
|
||||
ch_used[current_index].used[first_used] = false;
|
||||
ch_used[slot_no][current_index].used[first_used] = false;
|
||||
channel = 5;
|
||||
}else {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请选择正确的通道");
|
||||
|
@ -13,7 +13,7 @@ class DC_Output_Channel : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DC_Output_Channel(QString unit_str_,int current_index_,QWidget *parent = nullptr);
|
||||
explicit DC_Output_Channel(int slot_no_,QString unit_str_,int current_index_,QWidget *parent = nullptr);
|
||||
~DC_Output_Channel();
|
||||
signals:
|
||||
void output_channel_data_sg(int channel,float minmun,float maxmum,int not_used);
|
||||
@ -27,6 +27,7 @@ private:
|
||||
QString unit_str;
|
||||
int current_index;
|
||||
int first_used;
|
||||
int slot_no;
|
||||
QRadioButton *radiobtn[5];
|
||||
};
|
||||
|
||||
|
104
dc_outputs.cpp
104
dc_outputs.cpp
@ -7,7 +7,7 @@
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
|
||||
ChannelUsed ch_used[22];
|
||||
ChannelUsed ch_used[SLOT_NUM][22];
|
||||
|
||||
DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@ -67,7 +67,7 @@ void DC_Outputs::Init(){
|
||||
ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum));
|
||||
ui->label_ch_1_min_unit->setText(unit_str);
|
||||
ui->label_ch_1_max_unit->setText(unit_str);
|
||||
ch_used[vib_dc_output_ptr->dc_output[0].output_channel].used[0] = true;
|
||||
ch_used[slot_no][vib_dc_output_ptr->dc_output[0].output_channel].used[0] = true;
|
||||
}
|
||||
if(vib_dc_output_ptr->dc_output[1].output_channel != -1){
|
||||
unit_str = GetUnit(vib_dc_output_ptr->dc_output[1].output_channel);
|
||||
@ -76,7 +76,7 @@ void DC_Outputs::Init(){
|
||||
ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum));
|
||||
ui->label_ch_2_min_unit->setText(unit_str);
|
||||
ui->label_ch_2_max_unit->setText(unit_str);
|
||||
ch_used[vib_dc_output_ptr->dc_output[1].output_channel].used[1] = true;
|
||||
ch_used[slot_no][vib_dc_output_ptr->dc_output[1].output_channel].used[1] = true;
|
||||
}
|
||||
if(vib_dc_output_ptr->dc_output[2].output_channel != -1){
|
||||
unit_str = GetUnit(vib_dc_output_ptr->dc_output[2].output_channel);
|
||||
@ -85,7 +85,7 @@ void DC_Outputs::Init(){
|
||||
ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum));
|
||||
ui->label_ch_3_min_unit->setText(unit_str);
|
||||
ui->label_ch_3_max_unit->setText(unit_str);
|
||||
ch_used[vib_dc_output_ptr->dc_output[2].output_channel].used[2] = true;
|
||||
ch_used[slot_no][vib_dc_output_ptr->dc_output[2].output_channel].used[2] = true;
|
||||
}
|
||||
if(vib_dc_output_ptr->dc_output[3].output_channel != -1){
|
||||
unit_str = GetUnit(vib_dc_output_ptr->dc_output[3].output_channel);
|
||||
@ -94,7 +94,7 @@ void DC_Outputs::Init(){
|
||||
ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum));
|
||||
ui->label_ch_4_min_unit->setText(unit_str);
|
||||
ui->label_ch_4_max_unit->setText(unit_str);
|
||||
ch_used[vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true;
|
||||
ch_used[slot_no][vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true;
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
{
|
||||
current_index = index;
|
||||
QString unit_str = GetUnit(current_index);
|
||||
DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str,current_index);
|
||||
DC_Output_Channel *dc_output_channel = new DC_Output_Channel(slot_no,unit_str,current_index);
|
||||
dc_output_channel->setWindowModality(Qt::ApplicationModal);
|
||||
connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float,int)),this,SLOT(output_channel_data(int,float,float,int)));
|
||||
dc_output_channel->show();
|
||||
@ -212,14 +212,50 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int not_used){
|
||||
qDebug() << channel << minmun << maxmum ;
|
||||
QString unit_str = GetUnit(current_index);
|
||||
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if(ch_used[slot_no][current_index].used[i] && i != (channel - 1)){
|
||||
if(i == 0){
|
||||
label_ch1[0]->setText("未使用");
|
||||
label_ch1[1]->setText("-----");
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false;
|
||||
vib_dc_output_ptr->dc_output[0].output_channel = -1;
|
||||
}else if(i == 1){
|
||||
label_ch2[0]->setText("未使用");
|
||||
label_ch2[1]->setText("-----");
|
||||
label_ch2[2]->setText("-----");
|
||||
label_ch2[3]->setText("-----");
|
||||
label_ch2[4]->setText("-----");
|
||||
ch_used[slot_no][current_index].used[1] = false;
|
||||
vib_dc_output_ptr->dc_output[1].output_channel = -1;
|
||||
}else if(i == 2){
|
||||
label_ch3[0]->setText("未使用");
|
||||
label_ch3[1]->setText("-----");
|
||||
label_ch3[2]->setText("-----");
|
||||
label_ch3[3]->setText("-----");
|
||||
label_ch3[4]->setText("-----");
|
||||
ch_used[slot_no][current_index].used[2] = false;
|
||||
vib_dc_output_ptr->dc_output[2].output_channel = -1;
|
||||
}else if(i == 3){
|
||||
label_ch4[0]->setText("未使用");
|
||||
label_ch4[1]->setText("-----");
|
||||
label_ch4[2]->setText("-----");
|
||||
label_ch4[3]->setText("-----");
|
||||
label_ch4[4]->setText("-----");
|
||||
ch_used[slot_no][current_index].used[3] = false;
|
||||
vib_dc_output_ptr->dc_output[3].output_channel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(channel == 1){
|
||||
ui->label_ch_1->setText(ui->comboBox_ch_output->currentText());
|
||||
ui->label_ch_1_min->setText(QString::number(minmun));
|
||||
ui->label_ch_1_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_1_min_unit->setText(unit_str);
|
||||
ui->label_ch_1_max_unit->setText(unit_str);
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[0] = true;
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = true;
|
||||
vib_dc_output_ptr->dc_output[0].output_channel = current_index;
|
||||
vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||
@ -229,7 +265,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
ui->label_ch_2_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_2_min_unit->setText(unit_str);
|
||||
ui->label_ch_2_max_unit->setText(unit_str);
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[1] = true;
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = true;
|
||||
vib_dc_output_ptr->dc_output[1].output_channel = current_index;
|
||||
vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||
@ -239,7 +275,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
ui->label_ch_3_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_3_min_unit->setText(unit_str);
|
||||
ui->label_ch_3_max_unit->setText(unit_str);
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[2] = true;
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = true;
|
||||
vib_dc_output_ptr->dc_output[2].output_channel = current_index;
|
||||
vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||
@ -249,7 +285,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
ui->label_ch_4_max->setText(QString::number(maxmum));
|
||||
ui->label_ch_4_min_unit->setText(unit_str);
|
||||
ui->label_ch_4_max_unit->setText(unit_str);
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[3] = true;
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = true;
|
||||
vib_dc_output_ptr->dc_output[3].output_channel = current_index;
|
||||
vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
@ -260,31 +296,31 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[0] = false;
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false;
|
||||
vib_dc_output_ptr->dc_output[0].output_channel = -1;
|
||||
}else if(not_used == 1){
|
||||
label_ch1[0]->setText("未使用");
|
||||
label_ch1[1]->setText("-----");
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[1] = false;
|
||||
label_ch2[0]->setText("未使用");
|
||||
label_ch2[1]->setText("-----");
|
||||
label_ch2[2]->setText("-----");
|
||||
label_ch2[3]->setText("-----");
|
||||
label_ch2[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = false;
|
||||
vib_dc_output_ptr->dc_output[1].output_channel = -1;
|
||||
}else if(not_used == 2){
|
||||
label_ch1[0]->setText("未使用");
|
||||
label_ch1[1]->setText("-----");
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[2] = false;
|
||||
label_ch3[0]->setText("未使用");
|
||||
label_ch3[1]->setText("-----");
|
||||
label_ch3[2]->setText("-----");
|
||||
label_ch3[3]->setText("-----");
|
||||
label_ch3[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = false;
|
||||
vib_dc_output_ptr->dc_output[2].output_channel = -1;
|
||||
}else if(not_used == 3){
|
||||
label_ch1[0]->setText("未使用");
|
||||
label_ch1[1]->setText("-----");
|
||||
label_ch1[2]->setText("-----");
|
||||
label_ch1[3]->setText("-----");
|
||||
label_ch1[4]->setText("-----");
|
||||
ch_used[ui->comboBox_ch_output->currentIndex()].used[3] = false;
|
||||
label_ch4[0]->setText("未使用");
|
||||
label_ch4[1]->setText("-----");
|
||||
label_ch4[2]->setText("-----");
|
||||
label_ch4[3]->setText("-----");
|
||||
label_ch4[4]->setText("-----");
|
||||
ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = false;
|
||||
vib_dc_output_ptr->dc_output[3].output_channel = -1;
|
||||
}
|
||||
}
|
||||
@ -362,25 +398,25 @@ void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index)
|
||||
// ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel));
|
||||
// ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum));
|
||||
// ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum));
|
||||
// ch_used[current_index].used[0] = true;
|
||||
// ch_used[slot_no][current_index].used[0] = true;
|
||||
// }
|
||||
// if(vib_dc_output_ptr->dc_output[1].dc_output_channel == 2 && current_index == vib_dc_output_ptr->dc_output[1].output_channel){
|
||||
// ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel));
|
||||
// ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum));
|
||||
// ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum));
|
||||
// ch_used[current_index].used[1] = true;
|
||||
// ch_used[slot_no][current_index].used[1] = true;
|
||||
// }
|
||||
// if(vib_dc_output_ptr->dc_output[2].dc_output_channel == 3 && current_index == vib_dc_output_ptr->dc_output[2].output_channel){
|
||||
// ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel));
|
||||
// ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum));
|
||||
// ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum));
|
||||
// ch_used[current_index].used[2] = true;
|
||||
// ch_used[slot_no][current_index].used[2] = true;
|
||||
// }
|
||||
// if(vib_dc_output_ptr->dc_output[3].dc_output_channel == 4 && current_index == vib_dc_output_ptr->dc_output[3].output_channel){
|
||||
// ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel));
|
||||
// ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum));
|
||||
// ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum));
|
||||
// ch_used[current_index].used[3] = true;
|
||||
// ch_used[slot_no][current_index].used[3] = true;
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "macconfig.h"
|
||||
#include <QDateTime>
|
||||
#include "dc_outputs.h"
|
||||
#include "mqtt_config.h"
|
||||
|
||||
QString g_strServerIp;
|
||||
QString g_version;
|
||||
@ -101,6 +102,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
QObject::connect(ui->action_eth, &QAction::triggered, this, &MainWindow::onEthConfig);
|
||||
QObject::connect(ui->action_mac, &QAction::triggered, this, &MainWindow::onMACConfig);
|
||||
QObject::connect(ui->action_time, &QAction::triggered, this, &MainWindow::onSetTime);
|
||||
QObject::connect(ui->action_mqtt, &QAction::triggered, this, &MainWindow::onMqttConfig);
|
||||
|
||||
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat);
|
||||
g_strServerIp = settingsread.value("Server/IP").toString();
|
||||
@ -851,7 +853,7 @@ void MainWindow::readData(const QByteArray &data) {
|
||||
}else if(upload_config_rsp.code == 1){
|
||||
statusBar()->showMessage("上传失败!", 2000);
|
||||
}
|
||||
}else if(cmd == KConfigProgress){
|
||||
}else if(cmd == kConfigProgress){
|
||||
ConfigSubCardProgress config_sub_card_progress;
|
||||
memcpy(&config_sub_card_progress, data.data(), sizeof(ConfigSubCardProgress));
|
||||
QString status ;
|
||||
@ -896,6 +898,11 @@ void MainWindow::onMACConfig(){
|
||||
mac_config->setWindowModality(Qt::ApplicationModal);
|
||||
mac_config->show();
|
||||
}
|
||||
void MainWindow::onMqttConfig(){
|
||||
MqttConfig *mqtt_config = new MqttConfig();
|
||||
mqtt_config->setWindowModality(Qt::ApplicationModal);
|
||||
mqtt_config->show();
|
||||
}
|
||||
void MainWindow::onSetTime(){
|
||||
SetTimingReq set_time_req = { {0xAA, 0x55, 0xAA}, kTimingCmd, 1,0 };
|
||||
int length = sizeof(SetTimingReq);
|
||||
|
@ -76,6 +76,7 @@ private slots:
|
||||
void onEthConfig();
|
||||
void onMACConfig();
|
||||
void onSetTime();
|
||||
void onMqttConfig();
|
||||
|
||||
void onMenuActionTriggered();
|
||||
void on_pushButton_slot_clicked();
|
||||
|
@ -1087,6 +1087,7 @@
|
||||
<addaction name="action_time"/>
|
||||
<addaction name="action_eth"/>
|
||||
<addaction name="action_mac"/>
|
||||
<addaction name="action_mqtt"/>
|
||||
</widget>
|
||||
<addaction name="menu_start"/>
|
||||
<addaction name="menu_tool"/>
|
||||
@ -1138,6 +1139,11 @@
|
||||
<string>MAC配置</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_mqtt">
|
||||
<property name="text">
|
||||
<string>MQTT配置</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
53
mqtt_config.cpp
Normal file
53
mqtt_config.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "mqtt_config.h"
|
||||
#include "ui_mqtt_config.h"
|
||||
#include <QRegExpValidator>
|
||||
MqttConfig::MqttConfig(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MqttConfig)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString exp = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)"
|
||||
"{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
|
||||
QRegExp rege(exp);
|
||||
QValidator *Validator = new QRegExpValidator(rege);
|
||||
ui->lineEdit_ip->setValidator(Validator);
|
||||
m_tcpClient = MyTcpClient::instance();
|
||||
connect(m_tcpClient, SIGNAL(dataReceived(const QByteArray &)), this, SLOT(readData(const QByteArray &)));
|
||||
|
||||
}
|
||||
|
||||
MqttConfig::~MqttConfig()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void MqttConfig::readData(const QByteArray &data) {
|
||||
qDebug() << "Received from server:" << data;
|
||||
uint8_t cmd = data[3];
|
||||
if (cmd == kConfigMQTTBrokerInfo) {
|
||||
MQTTBrokerConfigInfoRsp mqtt_config_rsp;
|
||||
memcpy(&mqtt_config_rsp, data.data(), sizeof(MQTTBrokerConfigInfoRsp));
|
||||
qDebug() << "mqtt_config_rsp code" << mqtt_config_rsp.code ;
|
||||
}
|
||||
}
|
||||
void MqttConfig::on_pushButton_confirm_clicked()
|
||||
{
|
||||
MQTTBrokerConfigInfoReq mqtt_config = { {0xAA, 0x55, 0xAA}, kConfigMQTTBrokerInfo, 1,1,{} };
|
||||
memcpy(mqtt_config.ip,ui->lineEdit_ip->text().toStdString().c_str(),sizeof(mqtt_config.ip));
|
||||
mqtt_config.port = ui->lineEdit_port->text().toInt();
|
||||
char send_buf[100] ={0};
|
||||
memcpy(send_buf, (char*)&mqtt_config, sizeof(MQTTBrokerConfigInfoReq));
|
||||
|
||||
int length = sizeof(MQTTBrokerConfigInfoReq);
|
||||
qint64 bytesWritten = m_tcpClient->sendData(send_buf, length);
|
||||
m_tcpClient->waitForRead();
|
||||
qDebug() << "bytesWritten: " << bytesWritten;
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void MqttConfig::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
28
mqtt_config.h
Normal file
28
mqtt_config.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef MQTT_CONFIG_H
|
||||
#define MQTT_CONFIG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "MyTcpClient.h"
|
||||
namespace Ui {
|
||||
class MqttConfig;
|
||||
}
|
||||
|
||||
class MqttConfig : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MqttConfig(QWidget *parent = nullptr);
|
||||
~MqttConfig();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
void readData(const QByteArray&);
|
||||
private:
|
||||
Ui::MqttConfig *ui;
|
||||
MyTcpClient* m_tcpClient;
|
||||
};
|
||||
|
||||
#endif // MQTT_CONFIG_H
|
116
mqtt_config.ui
Normal file
116
mqtt_config.ui
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MqttConfig</class>
|
||||
<widget class="QWidget" name="MqttConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MQTT 配置</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>30</y>
|
||||
<width>111</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MQTT 服务器配置</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>90</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_ip">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>80</y>
|
||||
<width>151</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>130</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>端口:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_port">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>120</y>
|
||||
<width>151</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>230</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>230</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -4,7 +4,7 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
@ -131,9 +131,17 @@ void PressurePulsation::on_pushButton_confirm_clicked()
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibPressurePulsation;
|
||||
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibThrust) {
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
@ -217,7 +225,6 @@ void PressurePulsation::on_pushButton_confirm_clicked()
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
@ -297,3 +304,11 @@ void PressurePulsation::on_pushButton_cancel_clicked()
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void PressurePulsation::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ private slots:
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::PressurePulsation *ui;
|
||||
void Init();
|
||||
|
@ -473,7 +473,7 @@
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>220</x>
|
||||
<y>150</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -488,19 +488,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -513,7 +513,7 @@
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>220</x>
|
||||
<y>50</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -528,19 +528,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -578,7 +578,7 @@
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>220</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -593,19 +593,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
@ -143,9 +143,17 @@ void Radial::on_pushButton_confirm_clicked() {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibRadial;
|
||||
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibRadial) {
|
||||
std::shared_ptr<RadialVariable> variable = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibRadial || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
@ -227,7 +235,6 @@ void Radial::on_pushButton_confirm_clicked() {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<RadialVariable> variable = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
@ -302,3 +309,11 @@ void Radial::on_pushButton_confirm_clicked() {
|
||||
void Radial::on_pushButton_set_default_clicked() {
|
||||
}
|
||||
|
||||
|
||||
void Radial::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,9 @@ class Radial : public QWidget {
|
||||
|
||||
void on_checkBox_1x_ampl_toggled(bool checked);
|
||||
void on_checkBox_2x_ampl_toggled(bool checked);
|
||||
private:
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::Radial_vibration *ui;
|
||||
|
||||
void Init();
|
||||
|
@ -23,7 +23,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
@ -309,7 +309,7 @@
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>210</x>
|
||||
<y>150</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -322,7 +322,7 @@
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>210</x>
|
||||
<y>50</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -335,7 +335,7 @@
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>210</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -350,19 +350,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -382,19 +382,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -449,19 +449,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -897,7 +897,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_10">
|
||||
<attribute name="title">
|
||||
@ -906,7 +906,7 @@
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>210</x>
|
||||
<y>150</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -919,7 +919,7 @@
|
||||
<widget class="QLabel" name="label_45">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>210</x>
|
||||
<y>50</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -932,7 +932,7 @@
|
||||
<widget class="QLabel" name="label_46">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>210</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -947,19 +947,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -979,19 +979,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -1046,19 +1046,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -72,8 +72,8 @@ void Seismic_monitor::Init() {
|
||||
ui->doubleSpinBox_high_1->setValue(vib_data->base_config_[i].normal_voltage_high);
|
||||
|
||||
ui->checkBox_keyphase->setChecked(vib_data->base_config_[i].keyphase);
|
||||
ui->comboBox_keyphase_ch->setCurrentIndex(vib_data->base_config_[i].keyphase_ch);
|
||||
ui->comboBox_keyphase_slot->setCurrentIndex(vib_data->base_config_[i].keyphase_slot);
|
||||
ui->comboBox_keyphase_ch->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch));
|
||||
ui->comboBox_keyphase_slot->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot));
|
||||
|
||||
} else if (i + 1 == 2) {
|
||||
ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type);
|
||||
@ -85,8 +85,8 @@ void Seismic_monitor::Init() {
|
||||
ui->doubleSpinBox_high_2->setValue(vib_data->base_config_[i].normal_voltage_high);
|
||||
|
||||
ui->checkBox_keyphase_2->setChecked(vib_data->base_config_[i].keyphase);
|
||||
ui->comboBox_keyphase_ch_2->setCurrentIndex(vib_data->base_config_[i].keyphase_ch);
|
||||
ui->comboBox_keyphase_slot_2->setCurrentIndex(vib_data->base_config_[i].keyphase_slot);
|
||||
ui->comboBox_keyphase_ch_2->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch));
|
||||
ui->comboBox_keyphase_slot_2->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot));
|
||||
|
||||
} else if (i + 1 == 3) {
|
||||
ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby);
|
||||
@ -95,8 +95,8 @@ void Seismic_monitor::Init() {
|
||||
ui->lineEdit_signal_sensitivity_3->setText(QString::number(vib_data->base_config_[i].signal_sensitivity));
|
||||
|
||||
ui->checkBox_keyphase_3->setChecked(vib_data->base_config_[i].keyphase);
|
||||
ui->comboBox_keyphase_ch_3->setCurrentIndex(vib_data->base_config_[i].keyphase_ch);
|
||||
ui->comboBox_keyphase_slot_3->setCurrentIndex(vib_data->base_config_[i].keyphase_slot);
|
||||
ui->comboBox_keyphase_ch_3->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch));
|
||||
ui->comboBox_keyphase_slot_3->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot));
|
||||
|
||||
ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active);
|
||||
ui->doubleSpinBox_low_3->setValue(vib_data->base_config_[i].normal_voltage_low);
|
||||
@ -108,8 +108,8 @@ void Seismic_monitor::Init() {
|
||||
ui->lineEdit_signal_sensitivity_4->setText(QString::number(vib_data->base_config_[i].signal_sensitivity));
|
||||
|
||||
ui->checkBox_keyphase_4->setChecked(vib_data->base_config_[i].keyphase);
|
||||
ui->comboBox_keyphase_ch_4->setCurrentIndex(vib_data->base_config_[i].keyphase_ch);
|
||||
ui->comboBox_keyphase_slot_4->setCurrentIndex(vib_data->base_config_[i].keyphase_slot);
|
||||
ui->comboBox_keyphase_ch_4->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch));
|
||||
ui->comboBox_keyphase_slot_4->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot));
|
||||
|
||||
ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active);
|
||||
ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low);
|
||||
@ -206,7 +206,13 @@ void Seismic_monitor::on_pushButton_confirm_clicked() {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(ui->lineEdit_signal_sensitivity_1->text() == "0" ||
|
||||
ui->lineEdit_signal_sensitivity_2->text() == "0" ||
|
||||
ui->lineEdit_signal_sensitivity_3->text() == "0" ||
|
||||
ui->lineEdit_signal_sensitivity_4->text() == "0"){
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "传感器灵敏度填写错误!");
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
UpdateData(vib_data);
|
||||
|
@ -150,6 +150,8 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
int button_id = object_name.right(object_name.length() - 15).toInt();
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if(ptr == nullptr)
|
||||
return;
|
||||
QListWidgetItem *item_and = new QListWidgetItem("AND");
|
||||
item_and->setData(Qt::UserRole, "*");
|
||||
list_widget_available->addItem(item_and);
|
||||
|
42
trust.cpp
42
trust.cpp
@ -5,7 +5,7 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
@ -70,6 +70,7 @@ void Trust::Init() {
|
||||
else
|
||||
ui->comboBox_output_used->setCurrentIndex(1);
|
||||
ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->gap_general.engineering_unit);
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis));
|
||||
@ -103,9 +104,25 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_low_level->text().toFloat() > ui->lineEdit_alert_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "警报 + 高 必须大于 警报 + 低");
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_danger_low_level->text().toFloat() > ui->lineEdit_alert_low_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "警报 + 低 必须大于 危险 + 低");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibThrust;
|
||||
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibThrust) {
|
||||
std::shared_ptr<ThrustVariable> variable = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
@ -135,6 +152,8 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
else
|
||||
variable->gap_general.output_used = false;
|
||||
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
|
||||
// -alarm
|
||||
variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
@ -160,7 +179,6 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<ThrustVariable> variable = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
@ -181,6 +199,8 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
else
|
||||
variable->gap_general.output_used = false;
|
||||
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
|
||||
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
|
||||
// -alarm
|
||||
variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
@ -211,3 +231,19 @@ void Trust::on_pushButton_cancel_clicked()
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void Trust::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Trust::on_lineEdit_danger_low_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_danger_low_level->text().toFloat() > ui->lineEdit_alert_low_level->text().toDouble()){
|
||||
ui->lineEdit_alert_low_level->setText(ui->lineEdit_danger_low_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
4
trust.h
4
trust.h
@ -22,6 +22,10 @@ private slots:
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
void on_lineEdit_danger_low_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::Trust *ui;
|
||||
void Init();
|
||||
|
86
trust.ui
86
trust.ui
@ -296,7 +296,7 @@
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>230</x>
|
||||
<y>50</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -309,7 +309,7 @@
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>230</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -324,19 +324,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -414,19 +414,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -476,6 +476,76 @@
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>150</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>整流器</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_rectifier_funtion">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>True Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled Peak-To-Peak</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS Scaled AVG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RMS</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
|
20
velocity.cpp
20
velocity.cpp
@ -9,6 +9,7 @@
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -105,9 +106,17 @@ void Velocity::on_pushButton_confirm_clicked() {
|
||||
qCritical() << "[Acceleration::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
ptr->base_config_[channel - 1].channel_type = kVibVelocity;
|
||||
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibVelocity) {
|
||||
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibVelocity || variable == nullptr) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
@ -159,7 +168,6 @@ void Velocity::on_pushButton_confirm_clicked() {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->isChecked();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
@ -200,3 +208,11 @@ void Velocity::on_pushButton_confirm_clicked() {
|
||||
variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void Velocity::on_lineEdit_alert_high_level_editingFinished()
|
||||
{
|
||||
if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){
|
||||
ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,9 @@ class Velocity : public QWidget {
|
||||
void on_pushButton_confirm_clicked();
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
void on_lineEdit_alert_high_level_editingFinished();
|
||||
|
||||
private:
|
||||
Ui::Velocity *ui;
|
||||
|
||||
void Init();
|
||||
|
26
velocity.ui
26
velocity.ui
@ -300,7 +300,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
@ -309,7 +309,7 @@
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>220</x>
|
||||
<y>150</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -324,19 +324,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -379,7 +379,7 @@
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>220</x>
|
||||
<y>50</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -394,19 +394,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -459,7 +459,7 @@
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>220</x>
|
||||
<y>100</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
@ -474,19 +474,19 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<width>150</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user