add codes,modify config file

This commit is contained in:
DESKTOP-7I8SUIC\zhang 2025-07-29 22:01:19 +08:00
parent 3af645f080
commit fe33514c40
8 changed files with 102 additions and 108 deletions

View File

@ -65,8 +65,8 @@ void Acceleration::Init() {
ui->comboBox_output_used->setCurrentIndex(0); ui->comboBox_output_used->setCurrentIndex(0);
else else
ui->comboBox_output_used->setCurrentIndex(1); ui->comboBox_output_used->setCurrentIndex(1);
ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
// -alarm // -alarm
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
@ -160,8 +160,8 @@ void Acceleration::on_pushButton_confirm_clicked() {
variable->general.output_used = true; variable->general.output_used = true;
else else
variable->general.output_used = false; variable->general.output_used = false;
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
@ -234,8 +234,8 @@ void Acceleration::on_pushButton_confirm_clicked() {
variable->general.output_used = true; variable->general.output_used = true;
else else
variable->general.output_used = false; variable->general.output_used = false;
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();

View File

@ -403,7 +403,7 @@
</rect> </rect>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab_8"> <widget class="QWidget" name="tab_8">
<attribute name="title"> <attribute name="title">

View File

@ -74,27 +74,15 @@ void ConfigMgr::Save(QString & file_path) {
voltage_range.append(ptr->base_config_[cid].normal_voltage_low); voltage_range.append(ptr->base_config_[cid].normal_voltage_low);
voltage_range.append(ptr->base_config_[cid].normal_voltage_high); voltage_range.append(ptr->base_config_[cid].normal_voltage_high);
channel_item["normal_voltage_range"] = voltage_range; channel_item["normal_voltage_range"] = voltage_range;
// QJsonObject setpoint_data; QJsonObject setpoint_data;
// if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust ||
// ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){
// if(ptr->base_config_[cid].channel_type != kVibThrust){ if(ptr->base_config_[cid].channel_type != kVibThrust){
// setpoint_data["1x_ampl_upper"] = qRound(ptr->alert_danger[cid].x1_ampl_upper * 10)/10.0; channel_item["keyphase"] = ptr->base_config_[cid].keyphase;
// setpoint_data["1x_ampl_lower"] = qRound(ptr->alert_danger[cid].x1_ampl_lower * 10)/10.0; channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot;
// setpoint_data["1x_ampl_enable"] = ptr->alert_danger[cid].x1_ampl_enable; channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch;
// setpoint_data["2x_ampl_upper"] = qRound(ptr->alert_danger[cid].x2_ampl_upper * 10)/10.0; }
// setpoint_data["2x_ampl_lower"] = qRound(ptr->alert_danger[cid].x2_ampl_lower * 10)/10.0; }
// setpoint_data["2x_ampl_enable"] = ptr->alert_danger[cid].x2_ampl_enable;
// channel_item["keyphase"] = ptr->base_config_[cid].keyphase;
// channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot;
// channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch;
// }
// setpoint_data["direct_upper"] = qRound(ptr->alert_danger[cid].direct_upper * 10)/10.0;
// setpoint_data["direct_enable"] = ptr->alert_danger[cid].direct_enable;
// setpoint_data["danger_param"] = ptr->alert_danger[cid].danger_param;
// setpoint_data["danger_upper"] = qRound(ptr->alert_danger[cid].danger_upper * 10)/10.0;
// setpoint_data["danger_enable"] = ptr->alert_danger[cid].danger_enable;
// }
// if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ // if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){
// setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; // setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0;
// setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; // setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable;
@ -287,17 +275,17 @@ void ConfigMgr::Save(QString & file_path) {
variables["sampling"] = sampling; variables["sampling"] = sampling;
variables["scaling"] = scaling; variables["scaling"] = scaling;
QJsonArray freband_output_array; QJsonObject freband_output,number;
QJsonObject freband_output;
for (int var = 0; var < 10; ++var) { for (int var = 0; var < 10; ++var) {
if(pressure_ptr->freband_output[var].enable){ if(pressure_ptr->freband_output[var].start != 0 || pressure_ptr->freband_output[var].end != 0){
freband_output["enable"] = pressure_ptr->freband_output[var].enable; freband_output["enable"] = pressure_ptr->freband_output[var].enable;
freband_output["start"] = pressure_ptr->freband_output[var].start; freband_output["start"] = pressure_ptr->freband_output[var].start;
freband_output["end"] = pressure_ptr->freband_output[var].end; freband_output["end"] = pressure_ptr->freband_output[var].end;
freband_output_array.append(freband_output); number[QString::number(var + 1)] = freband_output;
//freband_output_array.append(freband_output);
} }
} }
variables["freband_output"] = freband_output_array; variables["freband_output"] = number;
} 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);
@ -351,17 +339,18 @@ void ConfigMgr::Save(QString & file_path) {
processed_output["general"] = general; processed_output["general"] = general;
processed_output["alarm"] = alarm; processed_output["alarm"] = alarm;
variables["processed_output"] = processed_output; variables["processed_output"] = processed_output;
QJsonArray freband_output_array; //QJsonArray freband_output_array;
QJsonObject freband_output; QJsonObject freband_output,number;
for (int var = 0; var < 10; ++var) { for (int var = 0; var < 10; ++var) {
if(av_ptr->freband_output[var].enable){ if(av_ptr->freband_output[var].start != 0 || av_ptr->freband_output[var].end != 0){
freband_output["enable"] = av_ptr->freband_output[var].enable; freband_output["enable"] = av_ptr->freband_output[var].enable;
freband_output["start"] = av_ptr->freband_output[var].start; freband_output["start"] = av_ptr->freband_output[var].start;
freband_output["end"] = av_ptr->freband_output[var].end; freband_output["end"] = av_ptr->freband_output[var].end;
freband_output_array.append(freband_output); number[QString::number(var + 1)] = freband_output;
//freband_output_array.append(freband_output);
} }
} }
variables["freband_output"] = freband_output_array; variables["freband_output"] = number;
}else if(ptr->base_config_[cid].channel_type == kVibVelocity){ }else if(ptr->base_config_[cid].channel_type == kVibVelocity){
std::shared_ptr<AccVelVariable> vel_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr); std::shared_ptr<AccVelVariable> vel_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
@ -571,26 +560,17 @@ void ConfigMgr::Load(QString filename) {
vib_data->base_config_[j].chan_id = channel["chan_id"].toString(); vib_data->base_config_[j].chan_id = channel["chan_id"].toString();
vib_data->base_config_[j].sensitivity_unit = channel["sensitivity_unit"].toInt(); vib_data->base_config_[j].sensitivity_unit = channel["sensitivity_unit"].toInt();
vib_data->base_config_[j].signal_sensitivity = channel["signal_sensitivity"].toDouble(); vib_data->base_config_[j].signal_sensitivity = channel["signal_sensitivity"].toDouble();
vib_data->base_config_[j].keyphase = channel["keyphase"].toBool();
vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
//setpoint //setpoint
// QJsonObject setpoint_data = channel["setpoint"].toObject(); QJsonObject setpoint_data = channel["setpoint"].toObject();
// if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust || if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust ||
// vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){ vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){
// vib_data->alert_danger[j].direct_upper = setpoint_data["direct_upper"].toDouble(); vib_data->base_config_[j].keyphase = channel["keyphase"].toBool();
// vib_data->alert_danger[j].direct_enable = setpoint_data["direct_enable"].toBool(); vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
// vib_data->alert_danger[j].x1_ampl_upper = setpoint_data["1x_ampl_upper"].toDouble(); vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
// vib_data->alert_danger[j].x1_ampl_lower = setpoint_data["1x_ampl_lower"].toDouble(); }
// vib_data->alert_danger[j].x1_ampl_enable = setpoint_data["1x_ampl_enable"].toBool();
// vib_data->alert_danger[j].x2_ampl_upper = setpoint_data["2x_ampl_upper"].toDouble();
// vib_data->alert_danger[j].x2_ampl_lower = setpoint_data["2x_ampl_lower"].toDouble();
// vib_data->alert_danger[j].x2_ampl_enable = setpoint_data["2x_ampl_enable"].toBool();
// vib_data->alert_danger[j].danger_param = setpoint_data["danger_param"].toInt();
// vib_data->alert_danger[j].danger_upper = setpoint_data["danger_upper"].toDouble();
// vib_data->alert_danger[j].danger_enable = setpoint_data["danger_enable"].toBool();
// vib_data->base_config_[j].keyphase = channel["keyphase"].toBool();
// vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
// vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
// }
// if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){ // if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){
// vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble(); // vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble();
// vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool(); // vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool();
@ -624,8 +604,8 @@ void ConfigMgr::Load(QString filename) {
g_general = gap["general"].toObject(); g_general = gap["general"].toObject();
g_alarm = gap["alarm"].toObject(); g_alarm = gap["alarm"].toObject();
variable->general.output_used = m_general["output_used"].toBool(); variable->general.output_used = m_general["output_used"].toBool();
variable->general.engineering_unit = m_general["engieneering_unit"].toString(); variable->general.engineering_unit = m_general["engieneering_unit"].toInt();
variable->general.rectifier_function = m_general["rectifier_function"].toString(); variable->general.rectifier_function = m_general["rectifier_function"].toInt();
variable->danger_high.level = m_alarm["danger_high_level"].toDouble(); variable->danger_high.level = m_alarm["danger_high_level"].toDouble();
variable->danger_high.hysteresis = m_alarm["danger_high_hysteresis"].toDouble(); variable->danger_high.hysteresis = m_alarm["danger_high_hysteresis"].toDouble();
variable->danger_high.delay = m_alarm["danger_high_delay"].toInt(); variable->danger_high.delay = m_alarm["danger_high_delay"].toInt();
@ -648,8 +628,8 @@ void ConfigMgr::Load(QString filename) {
variable->alert_low.latch = m_alarm["alert_low_latch"].toBool(); variable->alert_low.latch = m_alarm["alert_low_latch"].toBool();
variable->gap_general.output_used = g_general["output_used"].toBool(); variable->gap_general.output_used = g_general["output_used"].toBool();
variable->gap_general.engineering_unit = g_general["engieneering_unit"].toString(); variable->gap_general.engineering_unit = g_general["engieneering_unit"].toInt();
variable->gap_general.rectifier_function = g_general["rectifier_function"].toString(); variable->gap_general.rectifier_function = g_general["rectifier_function"].toInt();
variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble();
variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble();
variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt();
@ -690,8 +670,8 @@ void ConfigMgr::Load(QString filename) {
g_general = gap["general"].toObject(); g_general = gap["general"].toObject();
g_alarm = gap["alarm"].toObject(); g_alarm = gap["alarm"].toObject();
variable->gap_general.output_used = g_general["output_used"].toBool(); variable->gap_general.output_used = g_general["output_used"].toBool();
variable->gap_general.engineering_unit = g_general["engieneering_unit"].toString(); variable->gap_general.engineering_unit = g_general["engieneering_unit"].toInt();
variable->gap_general.rectifier_function = g_general["rectifier_function"].toString(); variable->gap_general.rectifier_function = g_general["rectifier_function"].toInt();
variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble();
variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble();
variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt();
@ -739,13 +719,16 @@ void ConfigMgr::Load(QString filename) {
variable->measuring_max = scaling["measuring_max"].toInt(); variable->measuring_max = scaling["measuring_max"].toInt();
variable->scale_min = scaling["scale_min"].toInt(); variable->scale_min = scaling["scale_min"].toInt();
variable->scale_max = scaling["scale_max"].toInt(); variable->scale_max = scaling["scale_max"].toInt();
QJsonArray freband_output_array = tmp_variable["freband_output"].toArray(); QJsonObject freband_output_obj = tmp_variable["freband_output"].toObject();
for (int k = 0; k < freband_output_array.size(); ++k) { QJsonObject number_obj;
QJsonObject freband_output = freband_output_array[k].toObject(); for (int k = 0; k < 10; ++k) {
number_obj = freband_output_obj[QString::number(k + 1)].toObject();
if(number_obj.isEmpty())
continue;
FrequencybandOutput output; FrequencybandOutput output;
output.enable = freband_output["enable"].toBool(); output.enable = number_obj["enable"].toBool();
output.start = freband_output["start"].toInt(); output.start = number_obj["start"].toInt();
output.end = freband_output["end"].toInt(); output.end = number_obj["end"].toInt();
variable->freband_output[k] = output; variable->freband_output[k] = output;
} }
vib_data->variables_.push_back(variable); vib_data->variables_.push_back(variable);
@ -767,8 +750,8 @@ void ConfigMgr::Load(QString filename) {
general = processed_output["general"].toObject(); general = processed_output["general"].toObject();
alarm = processed_output["alarm"].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"].toString(); variable->general.engineering_unit = general["engieneering_unit"].toInt();
variable->general.rectifier_function = general["rectifier_function"].toString(); variable->general.rectifier_function = general["rectifier_function"].toInt();
variable->danger_high.level = alarm["danger_high_level"].toDouble(); variable->danger_high.level = alarm["danger_high_level"].toDouble();
variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble();
variable->danger_high.delay = alarm["danger_high_delay"].toInt(); variable->danger_high.delay = alarm["danger_high_delay"].toInt();
@ -808,8 +791,8 @@ void ConfigMgr::Load(QString filename) {
general = processed_output["general"].toObject(); general = processed_output["general"].toObject();
alarm = processed_output["alarm"].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"].toString(); variable->general.engineering_unit = general["engieneering_unit"].toInt();
variable->general.rectifier_function = general["rectifier_function"].toString(); variable->general.rectifier_function = general["rectifier_function"].toInt();
variable->danger_high.level = alarm["danger_high_level"].toDouble(); variable->danger_high.level = alarm["danger_high_level"].toDouble();
variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble();
variable->danger_high.delay = alarm["danger_high_delay"].toInt(); variable->danger_high.delay = alarm["danger_high_delay"].toInt();
@ -830,14 +813,16 @@ void ConfigMgr::Load(QString filename) {
variable->alert_low.delay = alarm["alert_low_delay"].toInt(); variable->alert_low.delay = alarm["alert_low_delay"].toInt();
variable->alert_low.enable = alarm["alert_low_enable"].toBool(); variable->alert_low.enable = alarm["alert_low_enable"].toBool();
variable->alert_low.latch = alarm["alert_low_latch"].toBool(); variable->alert_low.latch = alarm["alert_low_latch"].toBool();
QJsonObject freband_output_obj = tmp_variable["freband_output"].toObject();
QJsonArray freband_output_array = tmp_variable["freband_output"].toArray(); QJsonObject number_obj;
for (int k = 0; k < freband_output_array.size(); ++k) { for (int k = 0; k < 10; ++k) {
QJsonObject freband_output = freband_output_array[k].toObject(); number_obj = freband_output_obj[QString::number(k + 1)].toObject();
if(number_obj.isEmpty())
continue;
FrequencybandOutput output; FrequencybandOutput output;
output.enable = freband_output["enable"].toBool(); output.enable = number_obj["enable"].toBool();
output.start = freband_output["start"].toInt(); output.start = number_obj["start"].toInt();
output.end = freband_output["end"].toInt(); output.end = number_obj["end"].toInt();
variable->freband_output[k] = output; variable->freband_output[k] = output;
} }
vib_data->variables_.push_back(variable); vib_data->variables_.push_back(variable);

View File

@ -153,8 +153,8 @@ typedef struct {
typedef struct{ typedef struct{
bool output_used; bool output_used;
QString engineering_unit; int engineering_unit;
QString rectifier_function; int rectifier_function;
}General; }General;
typedef struct{ typedef struct{
@ -165,10 +165,16 @@ typedef struct{
bool latch; bool latch;
}AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ; }AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ;
typedef struct{ typedef struct FrequencybandOutput_{
bool enable; bool enable;
int start; int start;
int end; int end;
FrequencybandOutput_()
{
enable = false;
start = 0;
end = 0;
}
}FrequencybandOutput ; }FrequencybandOutput ;
//typedef struct { //typedef struct {
// Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass // Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass

View File

@ -76,8 +76,8 @@ void Radial::Init() {
ui->comboBox_output_used->setCurrentIndex(0); ui->comboBox_output_used->setCurrentIndex(0);
else else
ui->comboBox_output_used->setCurrentIndex(1); ui->comboBox_output_used->setCurrentIndex(1);
ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
// -alarm // -alarm
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
@ -109,8 +109,8 @@ void Radial::Init() {
ui->comboBox_output_used_2->setCurrentIndex(0); ui->comboBox_output_used_2->setCurrentIndex(0);
else else
ui->comboBox_output_used_2->setCurrentIndex(1); ui->comboBox_output_used_2->setCurrentIndex(1);
ui->comboBox_engineering_unit_2->setCurrentText(variable_ptr->general.engineering_unit); ui->comboBox_engineering_unit_2->setCurrentIndex(variable_ptr->general.engineering_unit);
ui->comboBox_rectifier_funtion_2->setCurrentText(variable_ptr->general.rectifier_function); ui->comboBox_rectifier_funtion_2->setCurrentIndex(variable_ptr->general.rectifier_function);
// -alarm // -alarm
ui->lineEdit_danger_high_level_2->setText(QString::number(variable_ptr->gap_danger_high.level)); ui->lineEdit_danger_high_level_2->setText(QString::number(variable_ptr->gap_danger_high.level));
ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.hysteresis));
@ -170,8 +170,8 @@ void Radial::on_pushButton_confirm_clicked() {
variable->general.output_used = true; variable->general.output_used = true;
else else
variable->general.output_used = false; variable->general.output_used = false;
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
@ -199,8 +199,8 @@ void Radial::on_pushButton_confirm_clicked() {
variable->gap_general.output_used = true; variable->gap_general.output_used = true;
else else
variable->gap_general.output_used = false; variable->gap_general.output_used = false;
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentText(); variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentIndex();
variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentText(); variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentIndex();
// -alarm // -alarm
variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble();
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();
@ -243,6 +243,8 @@ void Radial::on_pushButton_confirm_clicked() {
variable->general.output_used = true; variable->general.output_used = true;
else else
variable->general.output_used = false; variable->general.output_used = false;
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
@ -270,6 +272,8 @@ void Radial::on_pushButton_confirm_clicked() {
variable->gap_general.output_used = true; variable->gap_general.output_used = true;
else else
variable->gap_general.output_used = false; variable->gap_general.output_used = false;
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentIndex();
variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentIndex();
// -alarm // -alarm
variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble();
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();

View File

@ -173,20 +173,19 @@ void Seismic_monitor::on_pushButton_confirm_clicked() {
// UpdateData(vib_data); // UpdateData(vib_data);
return; return;
} }
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) {
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) {
QMessageBox::information(this, QStringLiteral("提示"), "第一通道键相槽位选择错误!"); QMessageBox::information(this, QStringLiteral("提示"), "第一通道键相槽位选择错误!");
return; return;
} }
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) { if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) {
QMessageBox::information(this, QStringLiteral("提示"), "第二通道键相槽位选择错误!"); QMessageBox::information(this, QStringLiteral("提示"), "第二通道键相槽位选择错误!");
return; return;
} }
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) { if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) {
QMessageBox::information(this, QStringLiteral("提示"), "第三通道键相槽位选择错误!"); QMessageBox::information(this, QStringLiteral("提示"), "第三通道键相槽位选择错误!");
return; return;
} }
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) { if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) {
QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!"); QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!");
return; return;
} }

View File

@ -69,8 +69,8 @@ void Trust::Init() {
ui->comboBox_output_used->setCurrentIndex(0); ui->comboBox_output_used->setCurrentIndex(0);
else else
ui->comboBox_output_used->setCurrentIndex(1); ui->comboBox_output_used->setCurrentIndex(1);
ui->comboBox_engineering_unit->setCurrentText(variable_ptr->gap_general.engineering_unit); ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->gap_general.engineering_unit);
ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->gap_general.rectifier_function); ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->gap_general.rectifier_function);
// -alarm // -alarm
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level)); ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level));
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis));
@ -135,8 +135,8 @@ void Trust::on_pushButton_confirm_clicked()
variable->gap_general.output_used = true; variable->gap_general.output_used = true;
else else
variable->gap_general.output_used = false; variable->gap_general.output_used = false;
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
@ -182,8 +182,8 @@ void Trust::on_pushButton_confirm_clicked()
variable->gap_general.output_used = true; variable->gap_general.output_used = true;
else else
variable->gap_general.output_used = false; variable->gap_general.output_used = false;
variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();

View File

@ -69,8 +69,8 @@ void Velocity::Init() {
ui->comboBox_output_used->setCurrentIndex(0); ui->comboBox_output_used->setCurrentIndex(0);
else else
ui->comboBox_output_used->setCurrentIndex(1); ui->comboBox_output_used->setCurrentIndex(1);
ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit);
ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function);
// -alarm // -alarm
ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level));
ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis));
@ -132,8 +132,8 @@ void Velocity::on_pushButton_confirm_clicked() {
variable->general.output_used = true; variable->general.output_used = true;
else else
variable->general.output_used = false; variable->general.output_used = false;
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
@ -175,8 +175,8 @@ void Velocity::on_pushButton_confirm_clicked() {
variable->general.output_used = true; variable->general.output_used = true;
else else
variable->general.output_used = false; variable->general.output_used = false;
variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex();
variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex();
// -alarm // -alarm
variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble();
variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();