添加高速电流测点名称

This commit is contained in:
zhangsheng 2026-03-13 17:31:42 +08:00
parent 76c8206037
commit f160454b82
6 changed files with 180 additions and 7 deletions

View File

@ -59,7 +59,6 @@ void ChannelCRC::on_pushButton_get_clicked()
} }
} }
void ChannelCRC::readData(const QByteArray &data) { void ChannelCRC::readData(const QByteArray &data) {
qDebug() << "Received from server111:" << data;
uint8_t cmd = data[3]; uint8_t cmd = data[3];
if (cmd == kGetChannelCRCValue) { if (cmd == kGetChannelCRCValue) {
GetChannelCRCCountRsp get_ch_crc_rsp; GetChannelCRCCountRsp get_ch_crc_rsp;

View File

@ -4,6 +4,7 @@
#include "config_mgr.h" #include "config_mgr.h"
#include "vibrationdata.h" #include "vibrationdata.h"
#include "tachometer_data.h" #include "tachometer_data.h"
#include "high_speed_current_data.h"
#include <QMessageBox> #include <QMessageBox>
CopyChannel::CopyChannel(int slot_no_,QWidget *parent) : CopyChannel::CopyChannel(int slot_no_,QWidget *parent) :
@ -152,6 +153,20 @@ void CopyChannel::on_pushButton_confirm_clicked()
tachometer_data->alert_high[i] = tachometer_data->alert_high[var]; tachometer_data->alert_high[i] = tachometer_data->alert_high[var];
} }
} }
}else if(base_ptr->card_type_ == kCardHighSpeedCurrent){
std::shared_ptr<HighSpeedCurrentData> current_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
for (int i = 0; i < 4; i++) {
if(i != var && check_ch[i]->isChecked()){
QString point_name = current_data->variables_[i].point_name;
int id = current_data->variables_[i].id;
current_data->variables_[i] = current_data->variables_[var];
current_data->variables_[i].point_name = point_name;
current_data->variables_[i].id = id;
auto variable_base_old = current_data->variables_[i];
current_data->danger_high[i] = current_data->danger_high[var];
current_data->alert_high[i] = current_data->alert_high[var];
}
}
} }
emit copy_end_sg(); emit copy_end_sg();
this->close(); this->close();

View File

@ -2,6 +2,9 @@
#include "ui_high_speed_current.h" #include "ui_high_speed_current.h"
#include "config_mgr.h" #include "config_mgr.h"
#include <QMessageBox> #include <QMessageBox>
#include <QDoubleValidator>
#include <limits>
#include "copy_channel.h"
HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent) HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent)
: QWidget(parent) : QWidget(parent)
@ -12,6 +15,56 @@ HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *paren
card_type = cardtype; card_type = cardtype;
QString slot = QString("%1").arg(slot_no); QString slot = QString("%1").arg(slot_no);
ui->label_slot->setText(slot); ui->label_slot->setText(slot);
auto *double_validator = new QDoubleValidator(
std::numeric_limits<double>::lowest(),
std::numeric_limits<double>::max(),
10,
this);
double_validator->setNotation(QDoubleValidator::StandardNotation);
ui->lineEdit_fullScalePosition->setValidator(double_validator);
ui->lineEdit_xfullScalePosition->setValidator(double_validator);
ui->lineEdit_zeroScalePosition->setValidator(double_validator);
ui->lineEdit_xzeroScalePosition->setValidator(double_validator);
ui->lineEdit_danger_high_level->setValidator(double_validator);
ui->lineEdit_danger_high_hysteresis->setValidator(double_validator);
ui->lineEdit_danger_high_delay->setValidator(double_validator);
ui->lineEdit_alert_high_level->setValidator(double_validator);
ui->lineEdit_alert_high_hysteresis->setValidator(double_validator);
ui->lineEdit_alert_high_delay->setValidator(double_validator);
ui->lineEdit_fullScalePosition_2->setValidator(double_validator);
ui->lineEdit_xfullScalePosition_2->setValidator(double_validator);
ui->lineEdit_zeroScalePosition_2->setValidator(double_validator);
ui->lineEdit_xzeroScalePosition_2->setValidator(double_validator);
ui->lineEdit_danger_high_level_2->setValidator(double_validator);
ui->lineEdit_danger_high_hysteresis_2->setValidator(double_validator);
ui->lineEdit_danger_high_delay_2->setValidator(double_validator);
ui->lineEdit_alert_high_level_2->setValidator(double_validator);
ui->lineEdit_alert_high_hysteresis_2->setValidator(double_validator);
ui->lineEdit_alert_high_delay_2->setValidator(double_validator);
ui->lineEdit_fullScalePosition_3->setValidator(double_validator);
ui->lineEdit_xfullScalePosition_3->setValidator(double_validator);
ui->lineEdit_zeroScalePosition_3->setValidator(double_validator);
ui->lineEdit_xzeroScalePosition_3->setValidator(double_validator);
ui->lineEdit_danger_high_level_3->setValidator(double_validator);
ui->lineEdit_danger_high_hysteresis_3->setValidator(double_validator);
ui->lineEdit_danger_high_delay_3->setValidator(double_validator);
ui->lineEdit_alert_high_level_3->setValidator(double_validator);
ui->lineEdit_alert_high_hysteresis_3->setValidator(double_validator);
ui->lineEdit_alert_high_delay_3->setValidator(double_validator);
ui->lineEdit_fullScalePosition_4->setValidator(double_validator);
ui->lineEdit_xfullScalePosition_4->setValidator(double_validator);
ui->lineEdit_zeroScalePosition_4->setValidator(double_validator);
ui->lineEdit_xzeroScalePosition_4->setValidator(double_validator);
ui->lineEdit_danger_high_level_4->setValidator(double_validator);
ui->lineEdit_danger_high_hysteresis_4->setValidator(double_validator);
ui->lineEdit_danger_high_delay_4->setValidator(double_validator);
ui->lineEdit_alert_high_level_4->setValidator(double_validator);
ui->lineEdit_alert_high_hysteresis_4->setValidator(double_validator);
ui->lineEdit_alert_high_delay_4->setValidator(double_validator);
Init(); Init();
} }
@ -140,6 +193,8 @@ void HighSpeedCurrent::Init() {
ui->lineEdit_alert_high_delay->setText(QString::number(current_data->alert_high[i].delay)); ui->lineEdit_alert_high_delay->setText(QString::number(current_data->alert_high[i].delay));
ui->checkBox_alert_high_enable->setChecked(current_data->alert_high[i].enable); ui->checkBox_alert_high_enable->setChecked(current_data->alert_high[i].enable);
ui->checkBox_alert_high_latch->setChecked(current_data->alert_high[i].latch); ui->checkBox_alert_high_latch->setChecked(current_data->alert_high[i].latch);
ui->label_unit1->setText(current_data->variables_[i].engineering_unit);
ui->label_unit2->setText(current_data->variables_[i].engineering_unit);
}else if(i + 1 == 2){ }else if(i + 1 == 2){
ui->checkBox_chan_2->setChecked(current_data->variables_[i].active); ui->checkBox_chan_2->setChecked(current_data->variables_[i].active);
ui->lineEdit_engineeringUnit_2->setText(current_data->variables_[i].engineering_unit); ui->lineEdit_engineeringUnit_2->setText(current_data->variables_[i].engineering_unit);
@ -160,6 +215,8 @@ void HighSpeedCurrent::Init() {
ui->lineEdit_alert_high_delay_2->setText(QString::number(current_data->alert_high[i].delay)); ui->lineEdit_alert_high_delay_2->setText(QString::number(current_data->alert_high[i].delay));
ui->checkBox_alert_high_enable_2->setChecked(current_data->alert_high[i].enable); ui->checkBox_alert_high_enable_2->setChecked(current_data->alert_high[i].enable);
ui->checkBox_alert_high_latch_2->setChecked(current_data->alert_high[i].latch); ui->checkBox_alert_high_latch_2->setChecked(current_data->alert_high[i].latch);
ui->label_unit1_2->setText(current_data->variables_[i].engineering_unit);
ui->label_unit2_2->setText(current_data->variables_[i].engineering_unit);
}else if(i + 1 == 3){ }else if(i + 1 == 3){
ui->checkBox_chan_3->setChecked(current_data->variables_[i].active); ui->checkBox_chan_3->setChecked(current_data->variables_[i].active);
ui->lineEdit_engineeringUnit_3->setText(current_data->variables_[i].engineering_unit); ui->lineEdit_engineeringUnit_3->setText(current_data->variables_[i].engineering_unit);
@ -180,6 +237,8 @@ void HighSpeedCurrent::Init() {
ui->lineEdit_alert_high_delay_3->setText(QString::number(current_data->alert_high[i].delay)); ui->lineEdit_alert_high_delay_3->setText(QString::number(current_data->alert_high[i].delay));
ui->checkBox_alert_high_enable_3->setChecked(current_data->alert_high[i].enable); ui->checkBox_alert_high_enable_3->setChecked(current_data->alert_high[i].enable);
ui->checkBox_alert_high_latch_3->setChecked(current_data->alert_high[i].latch); ui->checkBox_alert_high_latch_3->setChecked(current_data->alert_high[i].latch);
ui->label_unit1_3->setText(current_data->variables_[i].engineering_unit);
ui->label_unit2_3->setText(current_data->variables_[i].engineering_unit);
}else if(i + 1 == 4){ }else if(i + 1 == 4){
ui->checkBox_chan_4->setChecked(current_data->variables_[i].active); ui->checkBox_chan_4->setChecked(current_data->variables_[i].active);
ui->lineEdit_engineeringUnit_4->setText(current_data->variables_[i].engineering_unit); ui->lineEdit_engineeringUnit_4->setText(current_data->variables_[i].engineering_unit);
@ -200,6 +259,8 @@ void HighSpeedCurrent::Init() {
ui->lineEdit_alert_high_delay_4->setText(QString::number(current_data->alert_high[i].delay)); ui->lineEdit_alert_high_delay_4->setText(QString::number(current_data->alert_high[i].delay));
ui->checkBox_alert_high_enable_4->setChecked(current_data->alert_high[i].enable); ui->checkBox_alert_high_enable_4->setChecked(current_data->alert_high[i].enable);
ui->checkBox_alert_high_latch_4->setChecked(current_data->alert_high[i].latch); ui->checkBox_alert_high_latch_4->setChecked(current_data->alert_high[i].latch);
ui->label_unit1_4->setText(current_data->variables_[i].engineering_unit);
ui->label_unit2_4->setText(current_data->variables_[i].engineering_unit);
} }
} }
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number); ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
@ -280,9 +341,14 @@ void HighSpeedCurrent::on_pushButton_cancel_clicked()
this->close(); this->close();
} }
void HighSpeedCurrent::copy_end_slot(){
Init();
}
void HighSpeedCurrent::on_pushButton_copy_channel_clicked() void HighSpeedCurrent::on_pushButton_copy_channel_clicked()
{ {
CopyChannel *copy_channel = new CopyChannel(slot_no);
connect(copy_channel,SIGNAL(copy_end_sg()),this,SLOT(copy_end_slot()));
copy_channel->setWindowModality(Qt::ApplicationModal);
copy_channel->show();
} }

View File

@ -34,6 +34,8 @@ private slots:
void on_pushButton_copy_channel_clicked(); void on_pushButton_copy_channel_clicked();
void copy_end_slot();
private: private:
Ui::HighSpeedCurrent *ui; Ui::HighSpeedCurrent *ui;
void UpdateData(std::shared_ptr<HighSpeedCurrentData> &current_data); void UpdateData(std::shared_ptr<HighSpeedCurrentData> &current_data);

View File

@ -335,6 +335,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_10"> <layout class="QHBoxLayout" name="horizontalLayout_10">
<item> <item>
<widget class="QLineEdit" name="lineEdit_fullScalePosition"> <widget class="QLineEdit" name="lineEdit_fullScalePosition">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -347,6 +350,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>24</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -401,6 +407,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -454,6 +463,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_25"> <layout class="QHBoxLayout" name="horizontalLayout_25">
<item> <item>
<widget class="QLineEdit" name="lineEdit_zeroScalePosition"> <widget class="QLineEdit" name="lineEdit_zeroScalePosition">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -466,6 +478,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -520,6 +535,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -583,6 +601,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="currentIndex">
<number>4</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>True Peak</string> <string>True Peak</string>
@ -933,7 +954,7 @@
<string/> <string/>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -1120,6 +1141,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_15"> <layout class="QHBoxLayout" name="horizontalLayout_15">
<item> <item>
<widget class="QLineEdit" name="lineEdit_fullScalePosition_2"> <widget class="QLineEdit" name="lineEdit_fullScalePosition_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -1132,6 +1156,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>24</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1186,6 +1213,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1239,6 +1269,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_26"> <layout class="QHBoxLayout" name="horizontalLayout_26">
<item> <item>
<widget class="QLineEdit" name="lineEdit_zeroScalePosition_2"> <widget class="QLineEdit" name="lineEdit_zeroScalePosition_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -1251,6 +1284,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1305,6 +1341,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1368,6 +1407,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="currentIndex">
<number>4</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>True Peak</string> <string>True Peak</string>
@ -1718,7 +1760,7 @@
<string/> <string/>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -1905,6 +1947,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_19"> <layout class="QHBoxLayout" name="horizontalLayout_19">
<item> <item>
<widget class="QLineEdit" name="lineEdit_fullScalePosition_3"> <widget class="QLineEdit" name="lineEdit_fullScalePosition_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -1917,6 +1962,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>24</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1971,6 +2019,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2024,6 +2075,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_27"> <layout class="QHBoxLayout" name="horizontalLayout_27">
<item> <item>
<widget class="QLineEdit" name="lineEdit_zeroScalePosition_3"> <widget class="QLineEdit" name="lineEdit_zeroScalePosition_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -2036,6 +2090,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2090,6 +2147,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2153,6 +2213,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="currentIndex">
<number>4</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>True Peak</string> <string>True Peak</string>
@ -2503,7 +2566,7 @@
<string/> <string/>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -2690,6 +2753,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_33"> <layout class="QHBoxLayout" name="horizontalLayout_33">
<item> <item>
<widget class="QLineEdit" name="lineEdit_fullScalePosition_4"> <widget class="QLineEdit" name="lineEdit_fullScalePosition_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -2702,6 +2768,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>24</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2756,6 +2825,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2809,6 +2881,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_35"> <layout class="QHBoxLayout" name="horizontalLayout_35">
<item> <item>
<widget class="QLineEdit" name="lineEdit_zeroScalePosition_4"> <widget class="QLineEdit" name="lineEdit_zeroScalePosition_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@ -2821,6 +2896,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2875,6 +2953,9 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="text">
<string>0</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -2938,6 +3019,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="currentIndex">
<number>4</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>True Peak</string> <string>True Peak</string>
@ -3288,7 +3372,7 @@
<string/> <string/>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -4,6 +4,7 @@
#include "vibrationdata.h" #include "vibrationdata.h"
#include "tachometer_data.h" #include "tachometer_data.h"
#include "keyphase_data.h" #include "keyphase_data.h"
#include "high_speed_current_data.h"
PointName::PointName(int slot_no_,CardType cardtype,QWidget *parent) : PointName::PointName(int slot_no_,CardType cardtype,QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -79,6 +80,12 @@ void PointName::on_pushButton_confirm_clicked()
keyphase_data->variables_[1].point_name = ui->lineEdit_pointname_2->text(); keyphase_data->variables_[1].point_name = ui->lineEdit_pointname_2->text();
keyphase_data->variables_[2].point_name = ui->lineEdit_pointname_3->text(); keyphase_data->variables_[2].point_name = ui->lineEdit_pointname_3->text();
keyphase_data->variables_[3].point_name = ui->lineEdit_pointname_4->text(); keyphase_data->variables_[3].point_name = ui->lineEdit_pointname_4->text();
}else if(base_ptr->card_type_ == kCardHighSpeedCurrent){
std::shared_ptr<HighSpeedCurrentData> keyphase_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
keyphase_data->variables_[0].point_name = ui->lineEdit_pointname_1->text();
keyphase_data->variables_[1].point_name = ui->lineEdit_pointname_2->text();
keyphase_data->variables_[2].point_name = ui->lineEdit_pointname_3->text();
keyphase_data->variables_[3].point_name = ui->lineEdit_pointname_4->text();
} }
this->close(); this->close();
} }