fix ch1 & 2 config bugs
This commit is contained in:
parent
3dd43ccf32
commit
faffd3695f
@ -107,7 +107,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
@ -65,7 +65,7 @@ int ConfigMgr::Save(QString & file_path) {
|
|||||||
ptr->base_config_[cid].channel_type == kVib34){
|
ptr->base_config_[cid].channel_type == kVib34){
|
||||||
channel_item["function"] = ptr->base_config_[cid].function;
|
channel_item["function"] = ptr->base_config_[cid].function;
|
||||||
if(ptr->base_config_[cid].function == kRST){
|
if(ptr->base_config_[cid].function == kRST){
|
||||||
channel_item["fisrt_channel_angle"] = ptr->base_config_[cid].fisrt_channel_angle;
|
channel_item["first_channel_angle"] = ptr->base_config_[cid].first_channel_angle;
|
||||||
channel_item["second_channel_angle"] = ptr->base_config_[cid].second_channel_angle;
|
channel_item["second_channel_angle"] = ptr->base_config_[cid].second_channel_angle;
|
||||||
}else if(ptr->base_config_[cid].function == kDMF){
|
}else if(ptr->base_config_[cid].function == kDMF){
|
||||||
channel_item["dmf_function"] = ptr->base_config_[cid].dmf_function;
|
channel_item["dmf_function"] = ptr->base_config_[cid].dmf_function;
|
||||||
@ -449,7 +449,10 @@ int ConfigMgr::Save(QString & file_path) {
|
|||||||
processed_output["alarm"] = alarm;
|
processed_output["alarm"] = alarm;
|
||||||
variables["processed_output"] = processed_output;
|
variables["processed_output"] = processed_output;
|
||||||
}
|
}
|
||||||
|
if(ptr->base_config_[cid].channel_type != kVib12 &&
|
||||||
|
ptr->base_config_[cid].channel_type != kVib34){
|
||||||
channel_item["variable"] = variables;
|
channel_item["variable"] = variables;
|
||||||
|
}
|
||||||
} else if (card_type_[i] == kCardSpeedSingle || card_type_[i] == kCardSpeedTMRPrimary) {
|
} else if (card_type_[i] == kCardSpeedSingle || card_type_[i] == kCardSpeedTMRPrimary) {
|
||||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
|
||||||
if (base_ptr == nullptr || cid > 3) {
|
if (base_ptr == nullptr || cid > 3) {
|
||||||
@ -592,8 +595,8 @@ int ConfigMgr::Save(QString & file_path) {
|
|||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
int ret = file.write(jsonDoc.toJson());
|
int ret = file.write(jsonDoc.toJson());
|
||||||
file.close();
|
file.close();
|
||||||
if(ret != 0){
|
if(ret == -1){
|
||||||
return -1;
|
return ret;
|
||||||
}else{
|
}else{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -676,7 +679,7 @@ void ConfigMgr::Load(QString filename) {
|
|||||||
vib_data->base_config_[j].channel_type == kVib34){
|
vib_data->base_config_[j].channel_type == kVib34){
|
||||||
vib_data->base_config_[j].function = channel["function"].toInt();
|
vib_data->base_config_[j].function = channel["function"].toInt();
|
||||||
if(vib_data->base_config_[j].function == kRST){
|
if(vib_data->base_config_[j].function == kRST){
|
||||||
vib_data->base_config_[j].fisrt_channel_angle = channel["fisrt_channel_angle"].toDouble();
|
vib_data->base_config_[j].first_channel_angle = channel["first_channel_angle"].toDouble();
|
||||||
vib_data->base_config_[j].second_channel_angle = channel["second_channel_angle"].toDouble();
|
vib_data->base_config_[j].second_channel_angle = channel["second_channel_angle"].toDouble();
|
||||||
}else if(vib_data->base_config_[j].function == kDMF){
|
}else if(vib_data->base_config_[j].function == kDMF){
|
||||||
vib_data->base_config_[j].dmf_function = channel["dmf_function"].toInt();
|
vib_data->base_config_[j].dmf_function = channel["dmf_function"].toInt();
|
||||||
|
|||||||
@ -284,7 +284,7 @@ typedef struct SeismicMonitor_{
|
|||||||
int sensitivity_unit;
|
int sensitivity_unit;
|
||||||
float signal_sensitivity;
|
float signal_sensitivity;
|
||||||
int function;
|
int function;
|
||||||
float fisrt_channel_angle;
|
float first_channel_angle;
|
||||||
float second_channel_angle;
|
float second_channel_angle;
|
||||||
int dmf_function;
|
int dmf_function;
|
||||||
SeismicMonitor_(){
|
SeismicMonitor_(){
|
||||||
|
|||||||
@ -645,13 +645,19 @@ void MainWindow::on_pushButton_save_clicked() {
|
|||||||
file_name = filepath + "\\"+file_name +".json";
|
file_name = filepath + "\\"+file_name +".json";
|
||||||
int ret = ConfigMgr::Instance()->Save(file_name);
|
int ret = ConfigMgr::Instance()->Save(file_name);
|
||||||
if(ret != 0){
|
if(ret != 0){
|
||||||
|
qDebug() << "ret1" << ret ;
|
||||||
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("文件保存失败!请检查文件权限!"));
|
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("文件保存失败!请检查文件权限!"));
|
||||||
|
}else{
|
||||||
|
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("文件保存成功!"));
|
||||||
}
|
}
|
||||||
tsi_config_file = file_name;
|
tsi_config_file = file_name;
|
||||||
}else {
|
}else {
|
||||||
int ret = ConfigMgr::Instance()->Save(tsi_config_file);
|
int ret = ConfigMgr::Instance()->Save(tsi_config_file);
|
||||||
if(ret != 0){
|
if(ret != 0){
|
||||||
|
qDebug() << "ret2" << ret ;
|
||||||
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("文件保存失败!请检查文件权限!"));
|
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("文件保存失败!请检查文件权限!"));
|
||||||
|
}else{
|
||||||
|
QMessageBox::warning(this, QStringLiteral("提示"), QStringLiteral("文件保存成功!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,6 +692,7 @@ void MainWindow::on_pushButton_open_clicked() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConfigMgr::Instance()->Load(tsi_config_file);
|
ConfigMgr::Instance()->Load(tsi_config_file);
|
||||||
|
file.close();
|
||||||
for (int i = 0; i < buttonList.count(); i++) {
|
for (int i = 0; i < buttonList.count(); i++) {
|
||||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(i + 1);
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(i + 1);
|
||||||
if(base_ptr != nullptr){
|
if(base_ptr != nullptr){
|
||||||
|
|||||||
@ -98,7 +98,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
@ -98,7 +98,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_5">
|
<widget class="QWidget" name="tab_5">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
@ -147,15 +147,16 @@ void Seismic_monitor::Init() {
|
|||||||
ui->label_text_2->setVisible(true);
|
ui->label_text_2->setVisible(true);
|
||||||
ui->comboBox_dual_math_function->setVisible(false);
|
ui->comboBox_dual_math_function->setVisible(false);
|
||||||
ui->label_text_5->setVisible(false);
|
ui->label_text_5->setVisible(false);
|
||||||
ui->lineEdit_first_1->setText(QString::number(vib_data->base_config_[i].fisrt_channel_angle));
|
ui->lineEdit_first_1->setText(QString::number(vib_data->base_config_[i].first_channel_angle));
|
||||||
ui->lineEdit_second_1->setText(QString::number(vib_data->base_config_[i].second_channel_angle));
|
ui->lineEdit_second_1->setText(QString::number(vib_data->base_config_[i].second_channel_angle));
|
||||||
}else if(vib_data->base_config_[i].function == kDMF){
|
}else if(vib_data->base_config_[i].function == kDMF){
|
||||||
ui->lineEdit_first_2->setVisible(false);
|
ui->lineEdit_first_1->setVisible(false);
|
||||||
ui->lineEdit_second_2->setVisible(false);
|
ui->lineEdit_second_1->setVisible(false);
|
||||||
ui->label_text_3->setVisible(false);
|
ui->label_text_1->setVisible(false);
|
||||||
ui->label_text_4->setVisible(false);
|
ui->label_text_2->setVisible(false);
|
||||||
ui->comboBox_dual_math_function->setVisible(true);
|
ui->comboBox_dual_math_function->setVisible(true);
|
||||||
ui->label_text_5->setVisible(true);
|
ui->label_text_5->setVisible(true);
|
||||||
|
ui->comboBox_dual_math_function->setCurrentIndex(vib_data->base_config_[i].dmf_function);
|
||||||
}
|
}
|
||||||
}else if (i + 1 == 6) {
|
}else if (i + 1 == 6) {
|
||||||
ui->comboBox_function_2->setCurrentIndex(vib_data->base_config_[i].function);
|
ui->comboBox_function_2->setCurrentIndex(vib_data->base_config_[i].function);
|
||||||
@ -166,7 +167,7 @@ void Seismic_monitor::Init() {
|
|||||||
ui->label_text_4->setVisible(true);
|
ui->label_text_4->setVisible(true);
|
||||||
ui->comboBox_dual_math_function_2->setVisible(false);
|
ui->comboBox_dual_math_function_2->setVisible(false);
|
||||||
ui->label_text_6->setVisible(false);
|
ui->label_text_6->setVisible(false);
|
||||||
ui->lineEdit_first_2->setText(QString::number(vib_data->base_config_[i].fisrt_channel_angle));
|
ui->lineEdit_first_2->setText(QString::number(vib_data->base_config_[i].first_channel_angle));
|
||||||
ui->lineEdit_second_2->setText(QString::number(vib_data->base_config_[i].second_channel_angle));
|
ui->lineEdit_second_2->setText(QString::number(vib_data->base_config_[i].second_channel_angle));
|
||||||
}else if(vib_data->base_config_[i].function == kDMF){
|
}else if(vib_data->base_config_[i].function == kDMF){
|
||||||
ui->lineEdit_first_2->setVisible(false);
|
ui->lineEdit_first_2->setVisible(false);
|
||||||
@ -175,6 +176,7 @@ void Seismic_monitor::Init() {
|
|||||||
ui->label_text_4->setVisible(false);
|
ui->label_text_4->setVisible(false);
|
||||||
ui->comboBox_dual_math_function_2->setVisible(true);
|
ui->comboBox_dual_math_function_2->setVisible(true);
|
||||||
ui->label_text_6->setVisible(true);
|
ui->label_text_6->setVisible(true);
|
||||||
|
ui->comboBox_dual_math_function_2->setCurrentIndex(vib_data->base_config_[i].dmf_function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,7 +259,7 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> vib_data) {
|
|||||||
}else if (var + 1 == 5) {
|
}else if (var + 1 == 5) {
|
||||||
vib_data->base_config_[var].function = ui->comboBox_function_1->currentIndex();
|
vib_data->base_config_[var].function = ui->comboBox_function_1->currentIndex();
|
||||||
if(ui->comboBox_function_1->currentIndex() == 3){
|
if(ui->comboBox_function_1->currentIndex() == 3){
|
||||||
vib_data->base_config_[var].fisrt_channel_angle = ui->lineEdit_first_1->text().toFloat();
|
vib_data->base_config_[var].first_channel_angle = ui->lineEdit_first_1->text().toFloat();
|
||||||
vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_1->text().toFloat();
|
vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_1->text().toFloat();
|
||||||
}else if(ui->comboBox_function_1->currentIndex() == 5){
|
}else if(ui->comboBox_function_1->currentIndex() == 5){
|
||||||
vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex();
|
vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex();
|
||||||
@ -266,10 +268,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> vib_data) {
|
|||||||
}else if (var + 1 == 6) {
|
}else if (var + 1 == 6) {
|
||||||
vib_data->base_config_[var].function = ui->comboBox_function_2->currentIndex();
|
vib_data->base_config_[var].function = ui->comboBox_function_2->currentIndex();
|
||||||
if(ui->comboBox_function_2->currentIndex() == 3){
|
if(ui->comboBox_function_2->currentIndex() == 3){
|
||||||
vib_data->base_config_[var].fisrt_channel_angle = ui->lineEdit_first_2->text().toFloat();
|
vib_data->base_config_[var].first_channel_angle = ui->lineEdit_first_2->text().toFloat();
|
||||||
vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_2->text().toFloat();
|
vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_2->text().toFloat();
|
||||||
}else if(ui->comboBox_function_1->currentIndex() == 5){
|
}else if(ui->comboBox_function_2->currentIndex() == 5){
|
||||||
vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex();
|
vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function_2->currentIndex();
|
||||||
}
|
}
|
||||||
vib_data->base_config_[var].channel_type = kVib34;
|
vib_data->base_config_[var].channel_type = kVib34;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1242,6 +1242,9 @@
|
|||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -1318,7 +1321,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>21</x>
|
<x>21</x>
|
||||||
@ -1342,6 +1345,9 @@
|
|||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -2564,12 +2570,15 @@
|
|||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_text_4">
|
<widget class="QLabel" name="label_text_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>第二通道安装角度</string>
|
<string>第四通道安装角度</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -2599,12 +2608,15 @@
|
|||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_text_3">
|
<widget class="QLabel" name="label_text_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>第一通道安装角度</string>
|
<string>第三通道安装角度</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@ -98,7 +98,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_5">
|
<widget class="QWidget" name="tab_5">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user