添加获取振动板卡辅助程序版本,转速板卡界面优化,通道复制,添加振动和转速板卡相对编号

This commit is contained in:
DESKTOP-7I8SUIC\zhang 2025-11-18 21:52:27 +08:00
parent 7e79055671
commit dbed030a0c
12 changed files with 2938 additions and 2893 deletions

View File

@ -14,6 +14,7 @@ class CardBase {
int version_; int version_;
int slot_; // 从1~15 int slot_; // 从1~15
CardType card_type_; CardType card_type_;
int relative_number;
}; };
class VariableBase { class VariableBase {

View File

@ -48,14 +48,15 @@ void ConfigMgr::Save(QString & file_path) {
card_type_[i] != kCardRelaySingleNOK && card_type_[i] != kCardRelaySingleNOK &&
card_type_[i] != kCardRelayTMRBackup) { card_type_[i] != kCardRelayTMRBackup) {
QJsonObject dc_output; QJsonObject dc_output;
for (int cid = 0; cid < CHANNEL_COUNT; ++cid) {
QJsonObject channel_item;
if (card_type_[i] == kCardVibSingle ||
card_type_[i] == kCardVibTMRPrimary) {
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot); std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
if (base_ptr == nullptr) { if (base_ptr == nullptr) {
continue; continue;
} }
for (int cid = 0; cid < CHANNEL_COUNT; ++cid) {
QJsonObject channel_item;
if (card_type_[i] == kCardVibSingle ||
card_type_[i] == kCardVibTMRPrimary) {
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr); std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
if( ptr->base_config_[cid].channel_type == -1){ if( ptr->base_config_[cid].channel_type == -1){
continue; continue;
@ -566,6 +567,7 @@ void ConfigMgr::Save(QString & file_path) {
slot_item["dc_output"] = dc_output; slot_item["dc_output"] = dc_output;
} }
slot_item["version"] = 1; slot_item["version"] = 1;
slot_item["relative_number"] = base_ptr->relative_number;
}else{ }else{
for(int ch = 0;ch < RELAY_COUNT;++ch){ for(int ch = 0;ch < RELAY_COUNT;++ch){
QJsonObject channel_item; QJsonObject channel_item;
@ -661,6 +663,7 @@ void ConfigMgr::Load(QString filename) {
vib_data->version_ = temp_obj["version"].toInt(); vib_data->version_ = temp_obj["version"].toInt();
vib_data->card_type_ = static_cast<CardType>(card_type_[i]); vib_data->card_type_ = static_cast<CardType>(card_type_[i]);
vib_data->slot_ = slot; vib_data->slot_ = slot;
vib_data->relative_number = temp_obj["relative_number"].toInt();
// dc_output // dc_output
QJsonObject dc_output_obj = temp_obj["dc_output"].toObject(); QJsonObject dc_output_obj = temp_obj["dc_output"].toObject();
if(!dc_output_obj.isEmpty()){ if(!dc_output_obj.isEmpty()){
@ -1036,6 +1039,7 @@ void ConfigMgr::Load(QString filename) {
speed_data->slot_ = slot; speed_data->slot_ = slot;
speed_data->card_type_ = static_cast<CardType>(card_type_[i]); speed_data->card_type_ = static_cast<CardType>(card_type_[i]);
speed_data->version_ = temp_obj["version"].toInt(); speed_data->version_ = temp_obj["version"].toInt();
speed_data->relative_number = temp_obj["relative_number"].toInt();
for (int j = 0; j < CHANNEL_COUNT_SPEED; ++j) { for (int j = 0; j < CHANNEL_COUNT_SPEED; ++j) {
channel = temp_obj[QString::number(j + 1)].toObject(); channel = temp_obj[QString::number(j + 1)].toObject();
speed_data->variables_[j].active = channel["active"].toBool(); speed_data->variables_[j].active = channel["active"].toBool();
@ -1054,7 +1058,7 @@ void ConfigMgr::Load(QString filename) {
speed_data->variables_[j].default_speed = channel["default_speed"].toInt(); speed_data->variables_[j].default_speed = channel["default_speed"].toInt();
speed_data->variables_[j].automatic_threshold = channel["automatic_threshold"].toBool(); speed_data->variables_[j].automatic_threshold = channel["automatic_threshold"].toBool();
speed_data->variables_[j].point_name = channel["point_name"].toString(); speed_data->variables_[j].point_name = channel["point_name"].toString();
if(channel.contains("alarmn")){ if(channel.contains("alarm")){
QJsonObject alarm = channel["alarm"].toObject(); QJsonObject alarm = channel["alarm"].toObject();
speed_data->danger_high[j].level = alarm["danger_high_level"].toDouble(); speed_data->danger_high[j].level = alarm["danger_high_level"].toDouble();
speed_data->danger_high[j].hysteresis = alarm["danger_high_hysteresis"].toDouble(); speed_data->danger_high[j].hysteresis = alarm["danger_high_hysteresis"].toDouble();

View File

@ -3,6 +3,7 @@
#include "data_config.h" #include "data_config.h"
#include "config_mgr.h" #include "config_mgr.h"
#include "vibrationdata.h" #include "vibrationdata.h"
#include "tachometer_data.h"
#include <QMessageBox> #include <QMessageBox>
CopyChannel::CopyChannel(int slot_no_,QWidget *parent) : CopyChannel::CopyChannel(int slot_no_,QWidget *parent) :
@ -96,7 +97,7 @@ void CopyChannel::on_pushButton_confirm_clicked()
qDebug() << "base_ptr"; qDebug() << "base_ptr";
return; return;
} }
if(base_ptr->card_type_ == kCardVibSingle){
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr); std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if(i != var && check_ch[i]->isChecked()){ if(i != var && check_ch[i]->isChecked()){
@ -137,6 +138,21 @@ void CopyChannel::on_pushButton_confirm_clicked()
} }
} }
} }
}else if(base_ptr->card_type_ == kCardSpeedSingle){
std::shared_ptr<TachometerData> tachometer_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
for (int i = 0; i < 4; i++) {
if(i != var && check_ch[i]->isChecked()){
QString point_name = tachometer_data->variables_[i].point_name;
int id = tachometer_data->variables_[i].id;
tachometer_data->variables_[i] = tachometer_data->variables_[var];
tachometer_data->variables_[i].point_name = point_name;
tachometer_data->variables_[i].id = id;
auto variable_base_old = tachometer_data->variables_[i];
tachometer_data->danger_high[i] = tachometer_data->danger_high[var];
tachometer_data->alert_high[i] = tachometer_data->alert_high[var];
}
}
}
emit copy_end_sg(); emit copy_end_sg();
this->close(); this->close();
} }

View File

@ -220,7 +220,8 @@ enum CMTCommand {
kCleanSubCardLatch = 30, // 清理子板特定通道的Latch状态 kCleanSubCardLatch = 30, // 清理子板特定通道的Latch状态
kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息 kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息
kConfigDeviceID = 32, // 配置设备编号编号范围为1~99 kConfigDeviceID = 32, // 配置设备编号编号范围为1~99
kGetVoltageRangeValue = 33 // 获取子板动态电压范围 kGetVoltageRangeValue = 33, // 获取子板动态电压范围
kGetVibAuxProcessVersion = 34
}; };
enum RS485Baudrate { enum RS485Baudrate {
kBaudrate2400 = 0, kBaudrate2400 = 0,
@ -293,12 +294,19 @@ typedef struct{
int rectifier_function; int rectifier_function;
}General; }General;
typedef struct{ typedef struct AlarmDangerHigh_{
float level; float level;
float hysteresis; float hysteresis;
float delay; float delay;
bool enable; bool enable;
bool latch; bool latch;
AlarmDangerHigh_(){
level = 0;
hysteresis = 0;
delay = 0;
enable = false;
latch = false;
}
}AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ; }AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ;
typedef struct FrequencybandOutput_{ typedef struct FrequencybandOutput_{
@ -828,6 +836,21 @@ typedef struct {
uint8_t device_id; // 设备编号 uint8_t device_id; // 设备编号
} DeviceIDConfigRsp; } DeviceIDConfigRsp;
// 获取振动板辅助进程版本号
typedef struct {
uint8_t head[3]; // 固定值0xAA55AA
uint8_t cmd;
uint8_t version; // 版本号默认为1
uint8_t card_id;
} GetAuxProcessVersionReq;
typedef struct {
uint8_t head[3]; // 固定值0xAA55AA
uint8_t cmd;
uint8_t version; // 版本号默认为1
uint8_t aux_version; // 辅助进程版本号
} GetAuxProcessVersionRsp;
struct BaseHeader { struct BaseHeader {
uint8_t head[3]; // 固定 0xAA 0x55 0xAA uint8_t head[3]; // 固定 0xAA 0x55 0xAA
uint8_t cmd; uint8_t cmd;

View File

@ -104,6 +104,7 @@ MainWindow::MainWindow(QWidget *parent)
QObject::connect(ui->action_deviveID, &QAction::triggered, this, &MainWindow::onConfigDeviceID); QObject::connect(ui->action_deviveID, &QAction::triggered, this, &MainWindow::onConfigDeviceID);
QObject::connect(ui->action_get_deviceID, &QAction::triggered, this, &MainWindow::onGetDeviceID); QObject::connect(ui->action_get_deviceID, &QAction::triggered, this, &MainWindow::onGetDeviceID);
QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat); QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat);
g_strServerIp = settingsread.value("Server/IP").toString(); g_strServerIp = settingsread.value("Server/IP").toString();
connectServer(); connectServer();
@ -210,6 +211,7 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
QAction *config_sub_card = mainMenu->addAction("更新配置"); QAction *config_sub_card = mainMenu->addAction("更新配置");
QAction *get_sub_log = mainMenu->addAction("获取日志"); QAction *get_sub_log = mainMenu->addAction("获取日志");
QAction *get_sub_card_voltage = mainMenu->addAction("获取电压范围"); QAction *get_sub_card_voltage = mainMenu->addAction("获取电压范围");
QAction *get_vib_version = mainMenu->addAction("获取振动板卡辅助程序版本");
// 绑定 **鼠标事件过滤器**,确保只响应右键 // 绑定 **鼠标事件过滤器**,确保只响应右键
// 设置右键菜单策略 // 设置右键菜单策略
@ -236,6 +238,8 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
QObject::connect(config_sub_card, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); QObject::connect(config_sub_card, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
QObject::connect(get_sub_log, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); QObject::connect(get_sub_log, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
QObject::connect(get_sub_card_voltage, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); QObject::connect(get_sub_card_voltage, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
QObject::connect(get_vib_version, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
} }
@ -401,6 +405,10 @@ void MainWindow::onMenuActionTriggered() {
GetSubLog(button_id); GetSubLog(button_id);
}else if (action->text() == "获取电压范围") { }else if (action->text() == "获取电压范围") {
GetVoltageRangeValue(button_id); GetVoltageRangeValue(button_id);
}else if (action->text() == "获取电压范围") {
GetVoltageRangeValue(button_id);
}else if(action->text() == "获取振动板卡辅助程序版本"){
GetVibVersion(button_id);
} }
break; // 找到按钮后,跳出循环 break; // 找到按钮后,跳出循环
} }
@ -811,6 +819,15 @@ void MainWindow::GetVoltageRangeValue(int slot){
m_tcpClient->waitForRead(); m_tcpClient->waitForRead();
qDebug() << "bytesWritten: " << bytesWritten; qDebug() << "bytesWritten: " << bytesWritten;
} }
void MainWindow::GetVibVersion(int slot){
slot_no = slot;
GetAuxProcessVersionReq get_vib_version_req = { {0xAA, 0x55, 0xAA}, kGetVibAuxProcessVersion, 1,0};
int length = sizeof(GetAuxProcessVersionReq);
get_vib_version_req.card_id = slot & 0xFF;
qint64 bytesWritten = m_tcpClient->sendData((char*)&get_vib_version_req, length);
m_tcpClient->waitForRead();
qDebug() << "bytesWritten: " << bytesWritten;
}
void MainWindow::readData(const QByteArray &data) { void MainWindow::readData(const QByteArray &data) {
qDebug() << "Received from server:" << data; qDebug() << "Received from server:" << data;
@ -919,6 +936,11 @@ void MainWindow::readData(const QByteArray &data) {
QString str = QString("设备ID %1").arg(device_config_rsp.device_id); QString str = QString("设备ID %1").arg(device_config_rsp.device_id);
QMessageBox::information(this, QStringLiteral("提示"), str); QMessageBox::information(this, QStringLiteral("提示"), str);
} }
}else if(cmd == kGetVibAuxProcessVersion){
GetAuxProcessVersionRsp get_vib_version_rsp;
memcpy(&get_vib_version_rsp, data.data(), sizeof(GetAuxProcessVersionRsp));
QString str = QString("辅助程序版本: %1").arg(get_vib_version_rsp.aux_version);
QMessageBox::information(this, QStringLiteral("提示"), str);
} }
} }
@ -962,6 +984,7 @@ void MainWindow::onGetDeviceID(){
m_tcpClient->waitForRead(); m_tcpClient->waitForRead();
qDebug() << "bytesWritten: " << bytesWritten; qDebug() << "bytesWritten: " << bytesWritten;
} }
void MainWindow::onConfigDeviceID(){ void MainWindow::onConfigDeviceID(){
QString strTips =QString("请输入0到99之间的数值"); QString strTips =QString("请输入0到99之间的数值");

View File

@ -63,6 +63,7 @@ private:
void connectServer(); void connectServer();
void UploadConfigFile(uint8_t sub_cmd); void UploadConfigFile(uint8_t sub_cmd);
void GetVoltageRangeValue(int slot); void GetVoltageRangeValue(int slot);
void GetVibVersion(int slot);
private slots: private slots:
@ -82,6 +83,7 @@ private slots:
void onConfigDeviceID(); void onConfigDeviceID();
void onGetDeviceID(); void onGetDeviceID();
void onMenuActionTriggered(); void onMenuActionTriggered();
void on_pushButton_slot_clicked(); void on_pushButton_slot_clicked();
void on_pushButton_chan_clicked(); void on_pushButton_chan_clicked();

View File

@ -1156,6 +1156,11 @@
<string>获取设备ID</string> <string>获取设备ID</string>
</property> </property>
</action> </action>
<action name="action_get_vib_version">
<property name="text">
<string>获取振动板卡辅助程序版本</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -33,8 +33,6 @@ Seismic_monitor::Seismic_monitor(int slot,int cardtype, QWidget *parent) :
car_type = static_cast<CardType>(cardtype); car_type = static_cast<CardType>(cardtype);
QString slot_no_ = QString("%1").arg(slot_no); QString slot_no_ = QString("%1").arg(slot_no);
ui->label_slot_no->setText(slot_no_); ui->label_slot_no->setText(slot_no_);
ui->checkBox_standby_1->hide();
ui->checkBox_standby_2->hide();
Init(); Init();
} }
@ -115,6 +113,7 @@ void Seismic_monitor::Init() {
} }
} }
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
} }
void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> vib_data) { void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> vib_data) {
@ -211,7 +210,20 @@ void Seismic_monitor::on_pushButton_confirm_clicked() {
QMessageBox::information(this, QStringLiteral("提示"), "传感器灵敏度填写错误!"); QMessageBox::information(this, QStringLiteral("提示"), "传感器灵敏度填写错误!");
return; return;
} }
for (int var = 0; var < SLOT_NUM; var ++) {
if(ui->comboBox_relative_number->currentIndex() != 0){
std::shared_ptr<CardBase> slot_base_ptr = ConfigMgr::Instance()->GetSlotPtr(var);
if(slot_base_ptr == nullptr || slot_base_ptr->card_type_ != kCardVibSingle)
continue;
qDebug() << "relative_number" << var << slot_base_ptr->relative_number;
if(slot_base_ptr->relative_number == ui->comboBox_relative_number->currentIndex() &&
slot_base_ptr->card_type_ != kCardSpeedSingle){
QMessageBox::information(this, QStringLiteral("提示"), "板卡相对编号重复!");
return;
}
}
}
base_ptr->relative_number = ui->comboBox_relative_number->currentIndex();
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr); std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
UpdateData(vib_data); UpdateData(vib_data);
this->close(); this->close();

View File

@ -46,7 +46,7 @@
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_42"> <layout class="QHBoxLayout" name="horizontalLayout_43">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -111,6 +111,107 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_42">
<item>
<widget class="QLabel" name="label_95">
<property name="text">
<string> 相对编号:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_relative_number">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>9</string>
</property>
</item>
<item>
<property name="text">
<string>10</string>
</property>
</item>
<item>
<property name="text">
<string>11</string>
</property>
</item>
<item>
<property name="text">
<string>12</string>
</property>
</item>
<item>
<property name="text">
<string>13</string>
</property>
</item>
<item>
<property name="text">
<string>14</string>
</property>
</item>
<item>
<property name="text">
<string>15</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -6,10 +6,11 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonParseError> #include <QJsonParseError>
#include <QJsonArray> #include <QJsonArray>
#include <QMessageBox>
#include "data_config.h" #include "data_config.h"
#include "config_mgr.h" #include "config_mgr.h"
#include "tachometer_data.h" #include "tachometer_data.h"
#include "copy_channel.h"
Tachometer::Tachometer(int slot_no_,int cardtype, QWidget *parent) Tachometer::Tachometer(int slot_no_,int cardtype, QWidget *parent)
: QDialog(parent) : QDialog(parent)
@ -93,8 +94,6 @@ void Tachometer::UpdateData(std::shared_ptr<TachometerData> &speed_data) {
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_1->value(); speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_1->value();
speed_data->variables_[i].record_output = ui->comboBox_record_output_1->currentIndex(); speed_data->variables_[i].record_output = ui->comboBox_record_output_1->currentIndex();
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_1->isChecked(); speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_1->isChecked();
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_1->isChecked();
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_1->isChecked();
// -alarm // -alarm
speed_data->danger_high[i].level = ui->lineEdit_danger_high_level->text().toDouble(); speed_data->danger_high[i].level = ui->lineEdit_danger_high_level->text().toDouble();
speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
@ -132,8 +131,7 @@ void Tachometer::UpdateData(std::shared_ptr<TachometerData> &speed_data) {
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_2->value(); speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_2->value();
speed_data->variables_[i].record_output = ui->comboBox_record_output_2->currentIndex(); speed_data->variables_[i].record_output = ui->comboBox_record_output_2->currentIndex();
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_2->isChecked(); speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_2->isChecked();
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_2->isChecked();
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_2->isChecked();
// -alarm // -alarm
speed_data->danger_high[i].level = ui->lineEdit_danger_high_level_2->text().toDouble(); speed_data->danger_high[i].level = ui->lineEdit_danger_high_level_2->text().toDouble();
speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();
@ -171,8 +169,7 @@ void Tachometer::UpdateData(std::shared_ptr<TachometerData> &speed_data) {
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_3->value(); speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_3->value();
speed_data->variables_[i].record_output = ui->comboBox_record_output_3->currentIndex(); speed_data->variables_[i].record_output = ui->comboBox_record_output_3->currentIndex();
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_3->isChecked(); speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_3->isChecked();
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_3->isChecked();
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_3->isChecked();
// -alarm // -alarm
speed_data->danger_high[i].level = ui->lineEdit_danger_high_level_3->text().toDouble(); speed_data->danger_high[i].level = ui->lineEdit_danger_high_level_3->text().toDouble();
speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_3->text().toDouble(); speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_3->text().toDouble();
@ -210,8 +207,7 @@ void Tachometer::UpdateData(std::shared_ptr<TachometerData> &speed_data) {
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_4->value(); speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_4->value();
speed_data->variables_[i].record_output = ui->comboBox_record_output_4->currentIndex(); speed_data->variables_[i].record_output = ui->comboBox_record_output_4->currentIndex();
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_4->isChecked(); speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_4->isChecked();
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_4->isChecked();
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_4->isChecked();
// -alarm // -alarm
speed_data->danger_high[i].level = ui->lineEdit_danger_high_level_4->text().toDouble(); speed_data->danger_high[i].level = ui->lineEdit_danger_high_level_4->text().toDouble();
speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_4->text().toDouble(); speed_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_4->text().toDouble();
@ -270,16 +266,7 @@ void Tachometer::Init() {
ui->spinBox_events_per_revolution_1->setValue(speed_data->variables_[i].events_per_revolution); ui->spinBox_events_per_revolution_1->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_1->setCurrentIndex(speed_data->variables_[i].record_output); ui->comboBox_record_output_1->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_1->setChecked(speed_data->variables_[i].two_ma_clamp); ui->checkBox_two_ma_clamp_1->setChecked(speed_data->variables_[i].two_ma_clamp);
if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_1->setCheckable(true);
} else {
ui->radioButton_alert_latching_1->setCheckable(false);
}
if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_1->setCheckable(true);
} else {
ui->radioButton_overspeed_latching_1->setCheckable(false);
}
// -alarm // -alarm
ui->lineEdit_danger_high_level->setText(QString::number(speed_data->danger_high[i].level)); ui->lineEdit_danger_high_level->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis->setText(QString::number(speed_data->danger_high[i].hysteresis)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -324,16 +311,7 @@ void Tachometer::Init() {
ui->spinBox_events_per_revolution_2->setValue(speed_data->variables_[i].events_per_revolution); ui->spinBox_events_per_revolution_2->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_2->setCurrentIndex(speed_data->variables_[i].record_output); ui->comboBox_record_output_2->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_2->setChecked(speed_data->variables_[i].two_ma_clamp); ui->checkBox_two_ma_clamp_2->setChecked(speed_data->variables_[i].two_ma_clamp);
if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_2->setCheckable(true);
} else {
ui->radioButton_alert_latching_2->setCheckable(false);
}
if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_2->setCheckable(true);
} else {
ui->radioButton_overspeed_latching_2->setCheckable(false);
}
// -alarm // -alarm
ui->lineEdit_danger_high_level_2->setText(QString::number(speed_data->danger_high[i].level)); ui->lineEdit_danger_high_level_2->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(speed_data->danger_high[i].hysteresis)); ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -378,16 +356,7 @@ void Tachometer::Init() {
ui->spinBox_events_per_revolution_3->setValue(speed_data->variables_[i].events_per_revolution); ui->spinBox_events_per_revolution_3->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_3->setCurrentIndex(speed_data->variables_[i].record_output); ui->comboBox_record_output_3->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_3->setChecked(speed_data->variables_[i].two_ma_clamp); ui->checkBox_two_ma_clamp_3->setChecked(speed_data->variables_[i].two_ma_clamp);
if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_3->setCheckable(true);
} else {
ui->radioButton_alert_latching_3->setCheckable(false);
}
if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_3->setCheckable(true);
} else {
ui->radioButton_overspeed_latching_3->setCheckable(false);
}
// -alarm // -alarm
ui->lineEdit_danger_high_level_3->setText(QString::number(speed_data->danger_high[i].level)); ui->lineEdit_danger_high_level_3->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis_3->setText(QString::number(speed_data->danger_high[i].hysteresis)); ui->lineEdit_danger_high_hysteresis_3->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -432,16 +401,7 @@ void Tachometer::Init() {
ui->spinBox_events_per_revolution_4->setValue(speed_data->variables_[i].events_per_revolution); ui->spinBox_events_per_revolution_4->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_4->setCurrentIndex(speed_data->variables_[i].record_output); ui->comboBox_record_output_4->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_4->setChecked(speed_data->variables_[i].two_ma_clamp); ui->checkBox_two_ma_clamp_4->setChecked(speed_data->variables_[i].two_ma_clamp);
if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_4->setCheckable(true);
} else {
ui->radioButton_alert_latching_4->setCheckable(false);
}
if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_4->setCheckable(true);
} else {
ui->radioButton_overspeed_latching_4->setCheckable(false);
}
// -alarm // -alarm
ui->lineEdit_danger_high_level_4->setText(QString::number(speed_data->danger_high[i].level)); ui->lineEdit_danger_high_level_4->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis_4->setText(QString::number(speed_data->danger_high[i].hysteresis)); ui->lineEdit_danger_high_hysteresis_4->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -468,6 +428,8 @@ void Tachometer::Init() {
// ui->checkBox_alert_low_latch_4->setChecked(speed_data->alert_low[i].latch); // ui->checkBox_alert_low_latch_4->setChecked(speed_data->alert_low[i].latch);
} }
} }
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
} }
void Tachometer::on_pushButton_confirm_clicked() { void Tachometer::on_pushButton_confirm_clicked() {
@ -476,6 +438,20 @@ void Tachometer::on_pushButton_confirm_clicked() {
qCritical() << " should not be here"; qCritical() << " should not be here";
return; return;
} }
for (int var = 0; var < SLOT_NUM; var ++) {
if(ui->comboBox_relative_number->currentIndex() != 0){
std::shared_ptr<CardBase> slot_base_ptr = ConfigMgr::Instance()->GetSlotPtr(var);
if(slot_base_ptr == nullptr || slot_base_ptr->card_type_ != kCardSpeedSingle)
continue;
qDebug() << "relative_number" << var << slot_base_ptr->relative_number;
if(slot_base_ptr->relative_number == ui->comboBox_relative_number->currentIndex() &&
slot_base_ptr->card_type_ != kCardVibSingle){
QMessageBox::information(this, QStringLiteral("提示"), "板卡相对编号重复!");
return;
}
}
}
base_ptr->relative_number = ui->comboBox_relative_number->currentIndex();
std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr); std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
UpdateData(speed_data); UpdateData(speed_data);
this->close(); this->close();
@ -490,3 +466,14 @@ void Tachometer::on_radioButton_automatic_threshold_1_clicked()
} }
void Tachometer::copy_end_slot(){
Init();
}
void Tachometer::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

@ -26,6 +26,9 @@ class Tachometer : public QDialog {
void on_manual_threshold_4_clicked(bool checked); void on_manual_threshold_4_clicked(bool checked);
void on_radioButton_automatic_threshold_1_clicked(); void on_radioButton_automatic_threshold_1_clicked();
void on_pushButton_copy_channel_clicked();
void copy_end_slot();
private: private:
Ui::Tachometer *ui; Ui::Tachometer *ui;
void UpdateData(std::shared_ptr<TachometerData> &speed_data); void UpdateData(std::shared_ptr<TachometerData> &speed_data);

File diff suppressed because it is too large Load Diff