fix press json bugs

This commit is contained in:
DESKTOP-7I8SUIC\zhang 2025-12-25 09:41:49 +08:00
parent 8a16b60a09
commit 18741a9f22

View File

@ -286,7 +286,7 @@ void ConfigMgr::Save(QString & file_path) {
// scaling["scale_max"] = pressure_ptr->scale_max; // scaling["scale_max"] = pressure_ptr->scale_max;
// variables["sampling"] = sampling; // variables["sampling"] = sampling;
// variables["scaling"] = scaling; // variables["scaling"] = scaling;
QJsonObject general,alarm; QJsonObject processed_output,general,alarm;
general["output_used"] = pressure_ptr->general.output_used; general["output_used"] = pressure_ptr->general.output_used;
general["engieneering_unit"] = pressure_ptr->general.engineering_unit; general["engieneering_unit"] = pressure_ptr->general.engineering_unit;
general["rectifier_function"] = pressure_ptr->general.rectifier_function; general["rectifier_function"] = pressure_ptr->general.rectifier_function;
@ -301,8 +301,8 @@ void ConfigMgr::Save(QString & file_path) {
alarm["alert_high_delay"] = pressure_ptr->alert_high.delay; alarm["alert_high_delay"] = pressure_ptr->alert_high.delay;
alarm["alert_high_enable"] = pressure_ptr->alert_high.enable; alarm["alert_high_enable"] = pressure_ptr->alert_high.enable;
alarm["alert_high_latch"] = pressure_ptr->alert_high.latch; alarm["alert_high_latch"] = pressure_ptr->alert_high.latch;
processed_output["general"] = general;
variables["general"] = general; processed_output["alarm"] = alarm;
QJsonObject freband_output,number; QJsonObject freband_output,number;
for (int var = 0; var < 10; ++var) { for (int var = 0; var < 10; ++var) {
if(pressure_ptr->freband_output[var].start != 0 || pressure_ptr->freband_output[var].end != 0){ if(pressure_ptr->freband_output[var].start != 0 || pressure_ptr->freband_output[var].end != 0){
@ -313,7 +313,7 @@ void ConfigMgr::Save(QString & file_path) {
} }
} }
variables["freband_output"] = number; variables["freband_output"] = number;
variables["alarm"] = alarm; variables["processed_output"] = processed_output;
} else if(ptr->base_config_[cid].channel_type == kVibAcc){ } else if(ptr->base_config_[cid].channel_type == kVibAcc){
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr); std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
@ -897,9 +897,10 @@ void ConfigMgr::Load(QString filename) {
variable->filter_[k].checked = filter_ele["checked"].toBool(); variable->filter_[k].checked = filter_ele["checked"].toBool();
} }
variable->id_ = j + 1; variable->id_ = j + 1;
QJsonObject general, alarm; QJsonObject processed_output, general, alarm;
general = tmp_variable["general"].toObject(); processed_output = tmp_variable["processed_output"].toObject();
alarm = tmp_variable["alarm"].toObject(); general = processed_output["general"].toObject();
alarm = processed_output["alarm"].toObject();
variable->general.output_used = general["output_used"].toBool(); variable->general.output_used = general["output_used"].toBool();
variable->general.engineering_unit = general["engieneering_unit"].toInt(); variable->general.engineering_unit = general["engieneering_unit"].toInt();
variable->general.rectifier_function = general["rectifier_function"].toInt(); variable->general.rectifier_function = general["rectifier_function"].toInt();