From f160454b82b62ac2558573fa2912b8d7b83a24c9 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Fri, 13 Mar 2026 17:31:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=AB=98=E9=80=9F=E7=94=B5?= =?UTF-8?q?=E6=B5=81=E6=B5=8B=E7=82=B9=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel_crc.cpp | 1 - copy_channel.cpp | 15 +++++++ high_speed_current.cpp | 70 +++++++++++++++++++++++++++++++- high_speed_current.h | 2 + high_speed_current.ui | 92 ++++++++++++++++++++++++++++++++++++++++-- pointname.cpp | 7 ++++ 6 files changed, 180 insertions(+), 7 deletions(-) diff --git a/channel_crc.cpp b/channel_crc.cpp index 533308f..fd0c768 100644 --- a/channel_crc.cpp +++ b/channel_crc.cpp @@ -59,7 +59,6 @@ void ChannelCRC::on_pushButton_get_clicked() } } void ChannelCRC::readData(const QByteArray &data) { - qDebug() << "Received from server111:" << data; uint8_t cmd = data[3]; if (cmd == kGetChannelCRCValue) { GetChannelCRCCountRsp get_ch_crc_rsp; diff --git a/copy_channel.cpp b/copy_channel.cpp index 9a01548..b6652ed 100644 --- a/copy_channel.cpp +++ b/copy_channel.cpp @@ -4,6 +4,7 @@ #include "config_mgr.h" #include "vibrationdata.h" #include "tachometer_data.h" +#include "high_speed_current_data.h" #include 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]; } } + }else if(base_ptr->card_type_ == kCardHighSpeedCurrent){ + std::shared_ptr current_data = std::dynamic_pointer_cast(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(); this->close(); diff --git a/high_speed_current.cpp b/high_speed_current.cpp index 967a392..53003c0 100644 --- a/high_speed_current.cpp +++ b/high_speed_current.cpp @@ -2,6 +2,9 @@ #include "ui_high_speed_current.h" #include "config_mgr.h" #include +#include +#include +#include "copy_channel.h" HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent) : QWidget(parent) @@ -12,6 +15,56 @@ HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *paren card_type = cardtype; QString slot = QString("%1").arg(slot_no); ui->label_slot->setText(slot); + auto *double_validator = new QDoubleValidator( + std::numeric_limits::lowest(), + std::numeric_limits::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(); } @@ -140,6 +193,8 @@ void HighSpeedCurrent::Init() { 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_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){ ui->checkBox_chan_2->setChecked(current_data->variables_[i].active); 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->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->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){ ui->checkBox_chan_3->setChecked(current_data->variables_[i].active); 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->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->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){ ui->checkBox_chan_4->setChecked(current_data->variables_[i].active); 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->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->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); @@ -280,9 +341,14 @@ void HighSpeedCurrent::on_pushButton_cancel_clicked() this->close(); } - +void HighSpeedCurrent::copy_end_slot(){ + Init(); +} 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(); } diff --git a/high_speed_current.h b/high_speed_current.h index e419fe5..7439217 100644 --- a/high_speed_current.h +++ b/high_speed_current.h @@ -34,6 +34,8 @@ private slots: void on_pushButton_copy_channel_clicked(); + void copy_end_slot(); + private: Ui::HighSpeedCurrent *ui; void UpdateData(std::shared_ptr ¤t_data); diff --git a/high_speed_current.ui b/high_speed_current.ui index ef45b10..c30b814 100644 --- a/high_speed_current.ui +++ b/high_speed_current.ui @@ -335,6 +335,9 @@ + + false + 60 @@ -347,6 +350,9 @@ 16777215 + + 24 + @@ -401,6 +407,9 @@ 16777215 + + 0 + @@ -454,6 +463,9 @@ + + false + 60 @@ -466,6 +478,9 @@ 16777215 + + 0 + @@ -520,6 +535,9 @@ 16777215 + + 0 + @@ -583,6 +601,9 @@ 25 + + 4 + True Peak @@ -933,7 +954,7 @@ - true + false @@ -1120,6 +1141,9 @@ + + false + 60 @@ -1132,6 +1156,9 @@ 16777215 + + 24 + @@ -1186,6 +1213,9 @@ 16777215 + + 0 + @@ -1239,6 +1269,9 @@ + + false + 60 @@ -1251,6 +1284,9 @@ 16777215 + + 0 + @@ -1305,6 +1341,9 @@ 16777215 + + 0 + @@ -1368,6 +1407,9 @@ 25 + + 4 + True Peak @@ -1718,7 +1760,7 @@ - true + false @@ -1905,6 +1947,9 @@ + + false + 60 @@ -1917,6 +1962,9 @@ 16777215 + + 24 + @@ -1971,6 +2019,9 @@ 16777215 + + 0 + @@ -2024,6 +2075,9 @@ + + false + 60 @@ -2036,6 +2090,9 @@ 16777215 + + 0 + @@ -2090,6 +2147,9 @@ 16777215 + + 0 + @@ -2153,6 +2213,9 @@ 25 + + 4 + True Peak @@ -2503,7 +2566,7 @@ - true + false @@ -2690,6 +2753,9 @@ + + false + 60 @@ -2702,6 +2768,9 @@ 16777215 + + 24 + @@ -2756,6 +2825,9 @@ 16777215 + + 0 + @@ -2809,6 +2881,9 @@ + + false + 60 @@ -2821,6 +2896,9 @@ 16777215 + + 0 + @@ -2875,6 +2953,9 @@ 16777215 + + 0 + @@ -2938,6 +3019,9 @@ 25 + + 4 + True Peak @@ -3288,7 +3372,7 @@ - true + false diff --git a/pointname.cpp b/pointname.cpp index cdda4b9..5cbf99a 100644 --- a/pointname.cpp +++ b/pointname.cpp @@ -4,6 +4,7 @@ #include "vibrationdata.h" #include "tachometer_data.h" #include "keyphase_data.h" +#include "high_speed_current_data.h" PointName::PointName(int slot_no_,CardType cardtype,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_[2].point_name = ui->lineEdit_pointname_3->text(); keyphase_data->variables_[3].point_name = ui->lineEdit_pointname_4->text(); + }else if(base_ptr->card_type_ == kCardHighSpeedCurrent){ + std::shared_ptr keyphase_data = std::dynamic_pointer_cast(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(); }