add point name

This commit is contained in:
DESKTOP-7I8SUIC\zhang 2025-07-10 15:23:58 +08:00
parent 889803339e
commit 8e2df6d291
4 changed files with 30 additions and 18 deletions

View File

@ -349,6 +349,7 @@ void ConfigMgr::Save(QString & file_path) {
channel_item.insert("speed_peak", ptr->variables_[cid].speed_peek);
channel_item.insert("default_speed", ptr->variables_[cid].default_speed);
channel_item.insert("automatic_threshold",ptr->variables_[cid].automatic_threshold);
channel_item.insert("point_name",ptr->variables_[cid].point_name);
} else if (card_type_[i] == kCardKeyphaseSingle) {
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
@ -701,6 +702,7 @@ void ConfigMgr::Load(QString filename) {
speed_data->variables_[j].speed_peek = channel["speed_peak"].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].point_name = channel["point_name"].toString();
QJsonObject setpoint_data = channel["setpoint"].toObject();

View File

@ -222,6 +222,7 @@ typedef struct {
typedef struct {
int id;
QString point_name;
bool active;
float normal_voltage_low;
float normal_voltage_high;

View File

@ -27,7 +27,6 @@
#include "ethconfig.h"
#include "macconfig.h"
#include <QDateTime>
#include "setpoint_pressure.h"
QString g_strServerIp;
QString g_version;
@ -504,12 +503,6 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
break;
}
}
// std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
// if(ptr->base_config_[button_id].channel_type == kVibPressurePulsation){
// SetpointPressure *setpoint_press = new SetpointPressure(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]);
// setpoint_press->setWindowModality(Qt::ApplicationModal);
// setpoint_press->show();
// }
}
if(slot_btn != NULL && ui->pushButton_point_name->isChecked()){
QString object_name = slot_btn->objectName();

View File

@ -2,6 +2,7 @@
#include "ui_pointname.h"
#include "config_mgr.h"
#include "vibrationdata.h"
#include "tachometer_data.h"
PointName::PointName(int slot_no_,int cardtype,QWidget *parent) :
QWidget(parent),
@ -25,12 +26,20 @@ void PointName::Init()
if (base_ptr == nullptr) {
return;
}
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
if(base_ptr->card_type_ == kCardVibSingle){
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
ui->lineEdit_pointname_1->setText(vib_data->base_config_[0].point_name);
ui->lineEdit_pointname_2->setText(vib_data->base_config_[1].point_name);
ui->lineEdit_pointname_3->setText(vib_data->base_config_[2].point_name);
ui->lineEdit_pointname_4->setText(vib_data->base_config_[3].point_name);
ui->lineEdit_pointname_1->setText(vib_data->base_config_[0].point_name);
ui->lineEdit_pointname_2->setText(vib_data->base_config_[1].point_name);
ui->lineEdit_pointname_3->setText(vib_data->base_config_[2].point_name);
ui->lineEdit_pointname_4->setText(vib_data->base_config_[3].point_name);
}else if(base_ptr->card_type_ == kCardSpeedSingle){
std::shared_ptr<TachometerData> tac_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
ui->lineEdit_pointname_1->setText(tac_data->variables_[0].point_name);
ui->lineEdit_pointname_2->setText(tac_data->variables_[1].point_name);
ui->lineEdit_pointname_3->setText(tac_data->variables_[2].point_name);
ui->lineEdit_pointname_4->setText(tac_data->variables_[3].point_name);
}
}
void PointName::on_pushButton_cancel_clicked()
@ -45,12 +54,19 @@ void PointName::on_pushButton_confirm_clicked()
if (base_ptr == nullptr) {
return;
}
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
vib_data->base_config_[0].point_name = ui->lineEdit_pointname_1->text();
vib_data->base_config_[1].point_name = ui->lineEdit_pointname_2->text();
vib_data->base_config_[2].point_name = ui->lineEdit_pointname_3->text();
vib_data->base_config_[3].point_name = ui->lineEdit_pointname_4->text();
if(base_ptr->card_type_ == kCardVibSingle){
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
vib_data->base_config_[0].point_name = ui->lineEdit_pointname_1->text();
vib_data->base_config_[1].point_name = ui->lineEdit_pointname_2->text();
vib_data->base_config_[2].point_name = ui->lineEdit_pointname_3->text();
vib_data->base_config_[3].point_name = ui->lineEdit_pointname_4->text();
}else if(base_ptr->card_type_ == kCardSpeedSingle){
std::shared_ptr<TachometerData> tac_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
tac_data->variables_[0].point_name = ui->lineEdit_pointname_1->text();
tac_data->variables_[1].point_name = ui->lineEdit_pointname_2->text();
tac_data->variables_[2].point_name = ui->lineEdit_pointname_3->text();
tac_data->variables_[3].point_name = ui->lineEdit_pointname_4->text();
}
this->close();
}