add codes.
This commit is contained in:
parent
4a0e1a44c5
commit
7575aa4aa9
@ -174,7 +174,10 @@ void Acceleration::Init() {
|
|||||||
}
|
}
|
||||||
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_[channel - 1].channel_type != kVibAcc) {
|
if (ptr->base_config_[channel - 1].channel_type != kVibAcc) {
|
||||||
// user change the channel type
|
// user change the channel type, load acceleration template
|
||||||
|
// std::shared_ptr<VibrationData> vib_data = std::make_shared<VibrationData>();
|
||||||
|
// ConfigMgr::Instance()->AddCard(vib_data);
|
||||||
|
// UpdateData(vib_data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ui->checkBox_low_pass->setChecked(ptr->filter_[channel - 1].filter[0].checked);
|
ui->checkBox_low_pass->setChecked(ptr->filter_[channel - 1].filter[0].checked);
|
||||||
@ -186,48 +189,38 @@ void Acceleration::Init() {
|
|||||||
ui->checkBox_band_pass->setChecked(ptr->filter_[channel - 1].filter[2].checked);
|
ui->checkBox_band_pass->setChecked(ptr->filter_[channel - 1].filter[2].checked);
|
||||||
ui->spinBox_band_pass_low->setValue(ptr->filter_[channel - 1].filter[2].low);
|
ui->spinBox_band_pass_low->setValue(ptr->filter_[channel - 1].filter[2].low);
|
||||||
ui->spinBox_band_pass_high->setValue(ptr->filter_[channel - 1].filter[2].high);
|
ui->spinBox_band_pass_high->setValue(ptr->filter_[channel - 1].filter[2].high);
|
||||||
// std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||||
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(ptr->GetChannelPtr(channel));
|
if (variable_base == nullptr) {
|
||||||
ui->comboBox_direct_value_range->setCurrentIndex(variables[i].full_sacle_range);
|
qDebug() << "no channel ptr";
|
||||||
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
|
return;
|
||||||
ui->label_bias_voltage->setText(QString::number(variables[i].bias_voltage));
|
|
||||||
ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
|
|
||||||
ui->comboBox_1x_value_range->setCurrentIndex(variables[i].full_sacle_range);
|
|
||||||
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
|
|
||||||
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].clamp_value);
|
|
||||||
ui->comboBox_2x_value_range->setCurrentIndex(variables[i].full_sacle_range);
|
|
||||||
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
|
|
||||||
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].clamp_value);
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
if (variables[i].type == "direct") {
|
|
||||||
ui->comboBox_direct_value_range->setCurrentIndex(variables[i].full_sacle_range);
|
|
||||||
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
|
|
||||||
} else if (variables[i].type == "bias_volt") {
|
|
||||||
ui->label_bias_voltage->setText(QString::number(variables[i].bias_voltage));
|
|
||||||
ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
|
|
||||||
} else if (variables[i].type == "1x_ampl") {
|
|
||||||
ui->comboBox_1x_value_range->setCurrentIndex(variables[i].full_sacle_range);
|
|
||||||
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
|
|
||||||
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].clamp_value);
|
|
||||||
} else if (variables[i].type == "2x_ampl") {
|
|
||||||
ui->comboBox_2x_value_range->setCurrentIndex(variables[i].full_sacle_range);
|
|
||||||
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
|
|
||||||
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].clamp_value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ui->spinBox_alert->setValue(delay.alert);
|
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||||
ui->doubleSpinBox_danger->setValue(delay.danger);
|
ui->comboBox_direct_value_range->setCurrentIndex(variable_ptr->direct_.full_scale_range);
|
||||||
ui->checkBox_100ms->setChecked(delay.active_100ms);
|
ui->doubleSpinBox_direct_clamp->setValue(variable_ptr->direct_.clamp_value);
|
||||||
ui->checkBox_rms->setChecked(alert_variables.rms_active);
|
// ui->label_bias_voltage->setText(QString::number(variable_ptr->direct_.bias_voltage));
|
||||||
ui->checkBox_integrate->setChecked(alert_variables.integrate_active);
|
// ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
|
||||||
ui->checkBox_alert_latching->setChecked(alert_variables.alert_latching);
|
// ui->comboBox_bias_volt_range->setCurrentIndex();
|
||||||
ui->checkBox_danger_latching->setChecked(alert_variables.danger_latching);
|
ui->checkBox_1x_ampl->setChecked(variable_ptr->x1_.checked);
|
||||||
ui->checkBox_timed_ok->setChecked(alert_variables.timed_ok);
|
ui->comboBox_1x_value_range->setCurrentIndex(variable_ptr->x1_.full_scale_range);
|
||||||
ui->comboBox_recorder_output->setCurrentIndex(alert_variables.recorder_output);
|
ui->doubleSpinBox_1x_ampl_clamp->setValue(variable_ptr->x1_.clamp_value);
|
||||||
ui->checkBox_two_ma_clamp->setChecked(alert_variables.two_ma_clamp);
|
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variable_ptr->x1_.phase_lag);
|
||||||
ui->doubleSpinBox_trip_multiply->setValue(alert_variables.trip_multiply);
|
ui->checkBox_2x_ampl->setChecked(variable_ptr->x2_.checked);
|
||||||
ui->comboBox_comparision->setCurrentText(alert_variables.comparision);
|
ui->comboBox_2x_value_range->setCurrentIndex(variable_ptr->x2_.full_scale_range);
|
||||||
ui->spinBox_comparision_percentage->setValue(alert_variables.comparision_percentage);
|
ui->doubleSpinBox_2x_ampl_clamp->setValue(variable_ptr->x2_.clamp_value);
|
||||||
|
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->x2_.phase_lag);
|
||||||
|
ui->spinBox_alert->setValue(variable_ptr->delay_.alert);
|
||||||
|
ui->doubleSpinBox_danger->setValue(variable_ptr->delay_.danger);
|
||||||
|
ui->checkBox_100ms->setChecked(variable_ptr->delay_.active_100ms);
|
||||||
|
ui->checkBox_rms->setChecked(variable_ptr->rms_active_);
|
||||||
|
ui->checkBox_integrate->setChecked(variable_ptr->integrate_active_);
|
||||||
|
ui->checkBox_alert_latching->setChecked(variable_ptr->alert_latching_);
|
||||||
|
ui->checkBox_danger_latching->setChecked(variable_ptr->danger_latching_);
|
||||||
|
ui->checkBox_timed_ok->setChecked(variable_ptr->timed_ok_);
|
||||||
|
ui->comboBox_recorder_output->setCurrentIndex(variable_ptr->recorder_out_.recorder_output);
|
||||||
|
ui->checkBox_two_ma_clamp->setChecked(variable_ptr->recorder_out_.two_ma_clamp);
|
||||||
|
ui->doubleSpinBox_trip_multiply->setValue(variable_ptr->recorder_out_.trip_multiply);
|
||||||
|
ui->comboBox_comparision->setCurrentIndex(variable_ptr->recorder_out_.comparision);
|
||||||
|
ui->spinBox_comparision_percentage->setValue(variable_ptr->recorder_out_.percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Acceleration::on_pushButton_confirm_clicked() {
|
void Acceleration::on_pushButton_confirm_clicked() {
|
||||||
@ -328,32 +321,12 @@ void Acceleration::on_pushButton_confirm_clicked() {
|
|||||||
variables_obj.insert("slot", slot_no);
|
variables_obj.insert("slot", slot_no);
|
||||||
variables_obj.insert("id", channel);
|
variables_obj.insert("id", channel);
|
||||||
variables_obj.insert("version", 1);
|
variables_obj.insert("version", 1);
|
||||||
// QJsonDocument jsonDoc_filter(filter_obj);
|
|
||||||
// QString filePath = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
|
||||||
// QFile file(filePath);
|
|
||||||
// if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
||||||
// qDebug() << "Cannot open file for writing:" << filePath;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// file.write(jsonDoc_filter.toJson());
|
|
||||||
// file.close();
|
|
||||||
// QJsonDocument jsonDoc_variables(variables_obj);
|
|
||||||
// filePath = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\acceleration_variables_%2.json").arg(slot_no).arg(channel);
|
|
||||||
// file.setFileName(filePath);
|
|
||||||
// if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
||||||
// qDebug() << "Cannot open file for writing:" << filePath;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// file.write(jsonDoc_variables.toJson());
|
|
||||||
// file.close();
|
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Acceleration::on_pushButton_set_default_clicked() {
|
void Acceleration::on_pushButton_set_default_clicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Acceleration::on_pushButton_cancel_clicked() {
|
void Acceleration::on_pushButton_cancel_clicked() {
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user