2025-07-09 20:24:50 +08:00
|
|
|
#include "pressure_pulsation.h"
|
|
|
|
#include "ui_pressure_pulsation.h"
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonArray>
|
|
|
|
|
|
|
|
#include "data_config.h"
|
|
|
|
#include "vibrationdata.h"
|
|
|
|
#include "config_mgr.h"
|
|
|
|
|
|
|
|
PressurePulsation::PressurePulsation(int slot_no_, int channel_, bool active,QWidget *parent) :
|
|
|
|
QWidget(parent),
|
|
|
|
ui(new Ui::PressurePulsation)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
slot_no = slot_no_;
|
|
|
|
channel = channel_;
|
|
|
|
QString chan = QString("%1").arg(channel);
|
|
|
|
QString slot = QString("%1").arg(slot_no);
|
|
|
|
ui->label_channel->setText(chan);
|
|
|
|
ui->label_slot->setText(slot);
|
|
|
|
if (active) {
|
|
|
|
ui->label_active->setText("(启用)");
|
|
|
|
} else {
|
|
|
|
ui->label_active->setText("(停用)");
|
|
|
|
}
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
PressurePulsation::~PressurePulsation()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
void PressurePulsation::Init() {
|
|
|
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
|
|
|
if (base_ptr == nullptr) {
|
|
|
|
qCritical() << "[Radial::Init] should not be here";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
|
|
|
if (ptr->base_config_[channel - 1].channel_type != kVibPressurePulsation) {
|
|
|
|
qDebug() << "[Radial::Init] channel type changes";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
|
|
|
if (variable_base == nullptr) {
|
|
|
|
qDebug() << "[Radial::Init] no channel ptr";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
|
|
|
ui->checkBox_low_pass->setChecked(variable_ptr->filter_[0].checked);
|
|
|
|
ui->spinBox_low_pass_low->setValue(variable_ptr->filter_[0].low);
|
|
|
|
ui->spinBox_low_pass_high->setValue(variable_ptr->filter_[0].high);
|
|
|
|
ui->checkBox_high_pass->setChecked(variable_ptr->filter_[1].checked);
|
|
|
|
ui->spinBox_high_pass_low->setValue(variable_ptr->filter_[1].low);
|
|
|
|
ui->spinBox_high_pass_high->setValue(variable_ptr->filter_[1].high);
|
|
|
|
ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked);
|
|
|
|
ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low);
|
|
|
|
ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high);
|
|
|
|
ui->radioButton_fixed->setChecked(variable_ptr->fixed);
|
|
|
|
ui->lineEdit_sample_rate->setText(QString::number(variable_ptr->sample_rate));
|
|
|
|
ui->lineEdit_bandwidth->setText(QString::number(variable_ptr->bandwidth));
|
|
|
|
ui->comboBox_fft_points->setCurrentText(QString::number(variable_ptr->fft_points));
|
|
|
|
ui->lineEdit_measuring_value_min->setText(QString::number(variable_ptr->measuring_min));
|
|
|
|
ui->lineEdit_measuring_value_max->setText(QString::number(variable_ptr->measuring_max));
|
|
|
|
ui->lineEdit_scale_value_min->setText(QString::number(variable_ptr->scale_min));
|
|
|
|
ui->lineEdit_scale_value_max->setText(QString::number(variable_ptr->scale_max));
|
2025-07-28 22:05:26 +08:00
|
|
|
|
|
|
|
ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable);
|
|
|
|
ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start));
|
|
|
|
ui->lineEdit_end->setText(QString::number(variable_ptr->freband_output[0].end));
|
|
|
|
ui->checkBox_enable_2->setChecked(variable_ptr->freband_output[1].enable);
|
|
|
|
ui->lineEdit_start_2->setText(QString::number(variable_ptr->freband_output[1].start));
|
|
|
|
ui->lineEdit_end_2->setText(QString::number(variable_ptr->freband_output[1].end));
|
|
|
|
ui->checkBox_enable_3->setChecked(variable_ptr->freband_output[2].enable);
|
|
|
|
ui->lineEdit_start_3->setText(QString::number(variable_ptr->freband_output[2].start));
|
|
|
|
ui->lineEdit_end_3->setText(QString::number(variable_ptr->freband_output[2].end));
|
|
|
|
ui->checkBox_enable_4->setChecked(variable_ptr->freband_output[3].enable);
|
|
|
|
ui->lineEdit_start_4->setText(QString::number(variable_ptr->freband_output[3].start));
|
|
|
|
ui->lineEdit_end_4->setText(QString::number(variable_ptr->freband_output[3].end));
|
|
|
|
ui->checkBox_enable_5->setChecked(variable_ptr->freband_output[4].enable);
|
|
|
|
ui->lineEdit_start_5->setText(QString::number(variable_ptr->freband_output[4].start));
|
|
|
|
ui->lineEdit_end_5->setText(QString::number(variable_ptr->freband_output[4].end));
|
|
|
|
ui->checkBox_enable_6->setChecked(variable_ptr->freband_output[5].enable);
|
|
|
|
ui->lineEdit_start_6->setText(QString::number(variable_ptr->freband_output[5].start));
|
|
|
|
ui->lineEdit_end_6->setText(QString::number(variable_ptr->freband_output[5].end));
|
|
|
|
ui->checkBox_enable_7->setChecked(variable_ptr->freband_output[6].enable);
|
|
|
|
ui->lineEdit_start_7->setText(QString::number(variable_ptr->freband_output[6].start));
|
|
|
|
ui->lineEdit_end_7->setText(QString::number(variable_ptr->freband_output[6].end));
|
|
|
|
ui->checkBox_enable_8->setChecked(variable_ptr->freband_output[7].enable);
|
|
|
|
ui->lineEdit_start_8->setText(QString::number(variable_ptr->freband_output[7].start));
|
|
|
|
ui->lineEdit_end_8->setText(QString::number(variable_ptr->freband_output[7].end));
|
|
|
|
ui->checkBox_enable_9->setChecked(variable_ptr->freband_output[8].enable);
|
|
|
|
ui->lineEdit_start_9->setText(QString::number(variable_ptr->freband_output[8].start));
|
|
|
|
ui->lineEdit_end_9->setText(QString::number(variable_ptr->freband_output[8].end));
|
|
|
|
ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable);
|
|
|
|
ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start));
|
|
|
|
ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end));
|
2025-07-09 20:24:50 +08:00
|
|
|
}
|
|
|
|
void PressurePulsation::on_pushButton_confirm_clicked()
|
|
|
|
{
|
|
|
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
|
|
|
if (base_ptr == nullptr) {
|
|
|
|
qCritical() << "[Radial::Init] should not be here";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
|
|
|
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
|
|
|
if (variable_base == nullptr || variable_base->type_ != kVibThrust) {
|
|
|
|
if (variable_base == nullptr) {
|
|
|
|
qDebug() << "no channel ptr";
|
|
|
|
} else {
|
|
|
|
ptr->RemoveChannel(channel);
|
|
|
|
qDebug() << "channel type change";
|
|
|
|
}
|
|
|
|
std::shared_ptr<PressurePulsationVariable> variable = std::make_shared<PressurePulsationVariable>();
|
|
|
|
variable->id_ = channel;
|
|
|
|
variable->type_ = kVibPressurePulsation;
|
|
|
|
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
|
|
|
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
|
|
|
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
|
|
|
variable->filter_[1].checked = ui->checkBox_high_pass->checkState();
|
|
|
|
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
|
|
|
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
|
|
|
variable->filter_[2].checked = ui->checkBox_band_pass->checkState();
|
|
|
|
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
|
|
|
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
|
|
|
variable->fixed = ui->radioButton_fixed->isChecked();
|
|
|
|
variable->sample_rate = ui->lineEdit_sample_rate->text().toUInt();
|
|
|
|
variable->bandwidth = ui->lineEdit_bandwidth->text().toInt();
|
|
|
|
variable->fft_points = ui->comboBox_fft_points->currentText().toInt();
|
|
|
|
variable->measuring_min = ui->lineEdit_measuring_value_min->text().toInt();
|
|
|
|
variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt();
|
|
|
|
variable->scale_min = ui->lineEdit_scale_value_min->text().toInt();
|
|
|
|
variable->scale_max = ui->lineEdit_scale_value_max->text().toInt();
|
2025-07-28 22:05:26 +08:00
|
|
|
// -freband output
|
|
|
|
variable->freband_output[0].enable = ui->checkBox_enable->isChecked();
|
|
|
|
variable->freband_output[0].start = ui->lineEdit_start->text().toDouble();
|
|
|
|
variable->freband_output[0].end = ui->lineEdit_end->text().toDouble();
|
|
|
|
variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked();
|
|
|
|
variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble();
|
|
|
|
variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble();
|
|
|
|
variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked();
|
|
|
|
variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble();
|
|
|
|
variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble();
|
|
|
|
variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked();
|
|
|
|
variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble();
|
|
|
|
variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble();
|
|
|
|
variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked();
|
|
|
|
variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble();
|
|
|
|
variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble();
|
|
|
|
variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked();
|
|
|
|
variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble();
|
|
|
|
variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble();
|
|
|
|
variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked();
|
|
|
|
variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble();
|
|
|
|
variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble();
|
|
|
|
variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked();
|
|
|
|
variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble();
|
|
|
|
variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble();
|
|
|
|
variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked();
|
|
|
|
variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble();
|
|
|
|
variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble();
|
|
|
|
variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked();
|
|
|
|
variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble();
|
|
|
|
variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble();
|
2025-07-09 20:24:50 +08:00
|
|
|
|
|
|
|
ptr->variables_.push_back(variable);
|
|
|
|
this->close();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
|
|
|
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
|
|
|
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
|
|
|
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
|
|
|
variable->filter_[1].checked = ui->checkBox_high_pass->checkState();
|
|
|
|
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
|
|
|
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
|
|
|
variable->filter_[2].checked = ui->checkBox_band_pass->checkState();
|
|
|
|
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
|
|
|
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
|
|
|
variable->fixed = ui->radioButton_fixed->isChecked();
|
|
|
|
variable->sample_rate = ui->lineEdit_sample_rate->text().toUInt();
|
|
|
|
variable->bandwidth = ui->lineEdit_bandwidth->text().toInt();
|
|
|
|
variable->fft_points = ui->comboBox_fft_points->currentText().toInt();
|
|
|
|
variable->measuring_min = ui->lineEdit_measuring_value_min->text().toInt();
|
|
|
|
variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt();
|
|
|
|
variable->scale_min = ui->lineEdit_scale_value_min->text().toInt();
|
|
|
|
variable->scale_max = ui->lineEdit_scale_value_max->text().toInt();
|
|
|
|
|
2025-07-28 22:05:26 +08:00
|
|
|
// -freband output
|
|
|
|
variable->freband_output[0].enable = ui->checkBox_enable->isChecked();
|
|
|
|
variable->freband_output[0].start = ui->lineEdit_start->text().toDouble();
|
|
|
|
variable->freband_output[0].end = ui->lineEdit_end->text().toDouble();
|
|
|
|
variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked();
|
|
|
|
variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble();
|
|
|
|
variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble();
|
|
|
|
variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked();
|
|
|
|
variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble();
|
|
|
|
variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble();
|
|
|
|
variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked();
|
|
|
|
variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble();
|
|
|
|
variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble();
|
|
|
|
variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked();
|
|
|
|
variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble();
|
|
|
|
variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble();
|
|
|
|
variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked();
|
|
|
|
variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble();
|
|
|
|
variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble();
|
|
|
|
variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked();
|
|
|
|
variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble();
|
|
|
|
variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble();
|
|
|
|
variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked();
|
|
|
|
variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble();
|
|
|
|
variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble();
|
|
|
|
variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked();
|
|
|
|
variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble();
|
|
|
|
variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble();
|
|
|
|
variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked();
|
|
|
|
variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble();
|
|
|
|
variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble();
|
|
|
|
|
2025-07-09 20:24:50 +08:00
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PressurePulsation::on_pushButton_cancel_clicked()
|
|
|
|
{
|
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|