2024-12-17 18:53:41 +08:00
|
|
|
#include "tachometer.h"
|
|
|
|
#include "ui_tachometer.h"
|
2025-03-21 10:42:24 +08:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonParseError>
|
|
|
|
#include <QJsonArray>
|
2024-12-17 18:53:41 +08:00
|
|
|
|
2025-04-02 14:07:37 +08:00
|
|
|
#include "data_config.h"
|
|
|
|
#include "config_mgr.h"
|
|
|
|
#include "tachometer_data.h"
|
|
|
|
|
2025-04-10 16:45:20 +08:00
|
|
|
Tachometer::Tachometer(int slot_no_,int cardtype, QWidget *parent)
|
2024-12-17 18:53:41 +08:00
|
|
|
: QDialog(parent)
|
2025-03-27 10:16:01 +08:00
|
|
|
, ui(new Ui::Tachometer) {
|
2024-12-17 18:53:41 +08:00
|
|
|
ui->setupUi(this);
|
2025-03-11 16:42:00 +08:00
|
|
|
ui->widget_body->setProperty("flag", "body");
|
2025-03-27 10:16:01 +08:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2025-03-21 10:42:24 +08:00
|
|
|
slot_no = slot_no_;
|
2025-04-10 16:45:20 +08:00
|
|
|
car_type = static_cast<CardType>(cardtype);
|
2025-03-21 10:42:24 +08:00
|
|
|
QString slot = QString("%1").arg(slot_no);
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->label_slot->setText(slot);
|
2025-03-21 10:42:24 +08:00
|
|
|
Init();
|
2025-03-28 10:17:18 +08:00
|
|
|
connect(ui->radioButton_manual_threshold_1, &QRadioButton::toggled, this, &Tachometer::on_manual_threshold_1_clicked);
|
|
|
|
connect(ui->radioButton_manual_threshold_2, &QRadioButton::toggled, this, &Tachometer::on_manual_threshold_2_clicked);
|
|
|
|
connect(ui->radioButton_manual_threshold_3, &QRadioButton::toggled, this, &Tachometer::on_manual_threshold_3_clicked);
|
|
|
|
connect(ui->radioButton_manual_threshold_4, &QRadioButton::toggled, this, &Tachometer::on_manual_threshold_4_clicked);
|
2024-12-17 18:53:41 +08:00
|
|
|
}
|
|
|
|
|
2025-03-27 10:16:01 +08:00
|
|
|
Tachometer::~Tachometer() {
|
2024-12-17 18:53:41 +08:00
|
|
|
delete ui;
|
|
|
|
}
|
2025-03-28 10:17:18 +08:00
|
|
|
|
|
|
|
void Tachometer::on_manual_threshold_1_clicked(bool checked) {
|
|
|
|
if (checked) {
|
|
|
|
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Tachometer::on_manual_threshold_2_clicked(bool checked) {
|
|
|
|
if (checked) {
|
|
|
|
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Tachometer::on_manual_threshold_3_clicked(bool checked) {
|
|
|
|
if (checked) {
|
|
|
|
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Tachometer::on_manual_threshold_4_clicked(bool checked) {
|
|
|
|
if (checked) {
|
|
|
|
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
2025-04-02 14:07:37 +08:00
|
|
|
void Tachometer::UpdateData(std::shared_ptr<TachometerData> &speed_data) {
|
|
|
|
speed_data->card_type_ = kCardSpeedSingle;
|
|
|
|
speed_data->slot_ = slot_no;
|
|
|
|
speed_data->version_ = 1;
|
|
|
|
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
|
|
|
if (i + 1 == 1) {
|
|
|
|
speed_data->variables_[i].active = ui->checkBox_chan_1->isChecked();
|
|
|
|
speed_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_1->value();
|
|
|
|
speed_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_1->value();
|
|
|
|
speed_data->variables_[i].speed_peek = ui->full_scale_range_1->value();
|
|
|
|
speed_data->variables_[i].default_speed = ui->default_value_1->value();
|
2025-04-17 14:06:21 +08:00
|
|
|
if(ui->radioButton_automatic_threshold_1->isChecked()){
|
|
|
|
speed_data->variables_[i].automatic_threshold = true;
|
|
|
|
}else{
|
|
|
|
speed_data->variables_[i].automatic_threshold = false;
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
speed_data->variables_[i].threshold = ui->doubleSpinBox_threshold_1->value();
|
|
|
|
speed_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_1->value();
|
|
|
|
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_1->value();
|
|
|
|
speed_data->variables_[i].record_output = ui->comboBox_record_output_1->currentIndex();
|
|
|
|
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_1->isChecked();
|
|
|
|
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_1->isChecked();
|
|
|
|
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_1->isChecked();
|
|
|
|
} else if (i + 1 == 2) {
|
|
|
|
speed_data->variables_[i].active = ui->checkBox_chan_2->isChecked();
|
|
|
|
speed_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_2->value();
|
|
|
|
speed_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_2->value();
|
|
|
|
speed_data->variables_[i].speed_peek = ui->full_scale_range_2->value();
|
|
|
|
speed_data->variables_[i].default_speed = ui->default_value_2->value();
|
2025-04-17 14:06:21 +08:00
|
|
|
if(ui->radioButton_automatic_threshold_2->isChecked()){
|
|
|
|
speed_data->variables_[i].automatic_threshold = true;
|
|
|
|
}else{
|
|
|
|
speed_data->variables_[i].automatic_threshold = false;
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
speed_data->variables_[i].threshold = ui->doubleSpinBox_threshold_2->value();
|
|
|
|
speed_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_2->value();
|
|
|
|
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_2->value();
|
|
|
|
speed_data->variables_[i].record_output = ui->comboBox_record_output_2->currentIndex();
|
|
|
|
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_2->isChecked();
|
|
|
|
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_2->isChecked();
|
|
|
|
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_2->isChecked();
|
|
|
|
} else if (i + 1 == 3) {
|
|
|
|
speed_data->variables_[i].active = ui->checkBox_chan_3->isChecked();
|
|
|
|
speed_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_3->value();
|
|
|
|
speed_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_3->value();
|
|
|
|
speed_data->variables_[i].speed_peek = ui->full_scale_range_3->value();
|
|
|
|
speed_data->variables_[i].default_speed = ui->default_value_3->value();
|
2025-04-17 14:06:21 +08:00
|
|
|
if(ui->radioButton_automatic_threshold_3->isChecked()){
|
|
|
|
speed_data->variables_[i].automatic_threshold = true;
|
|
|
|
}else{
|
|
|
|
speed_data->variables_[i].automatic_threshold = false;
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
speed_data->variables_[i].threshold = ui->doubleSpinBox_threshold_3->value();
|
|
|
|
speed_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_3->value();
|
|
|
|
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_3->value();
|
|
|
|
speed_data->variables_[i].record_output = ui->comboBox_record_output_3->currentIndex();
|
|
|
|
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_3->isChecked();
|
|
|
|
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_3->isChecked();
|
|
|
|
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_3->isChecked();
|
|
|
|
} else if (i + 1 == 4) {
|
|
|
|
speed_data->variables_[i].active = ui->checkBox_chan_4->isChecked();
|
|
|
|
speed_data->variables_[i].normal_voltage_high = ui->doubleSpinBox_high_4->value();
|
|
|
|
speed_data->variables_[i].normal_voltage_low = ui->doubleSpinBox_low_4->value();
|
|
|
|
speed_data->variables_[i].speed_peek = ui->full_scale_range_4->value();
|
|
|
|
speed_data->variables_[i].default_speed = ui->default_value_4->value();
|
2025-04-17 14:06:21 +08:00
|
|
|
if(ui->radioButton_automatic_threshold_4->isChecked()){
|
|
|
|
speed_data->variables_[i].automatic_threshold = true;
|
|
|
|
}else{
|
|
|
|
speed_data->variables_[i].automatic_threshold = false;
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
speed_data->variables_[i].threshold = ui->doubleSpinBox_threshold_4->value();
|
|
|
|
speed_data->variables_[i].hysteresis = ui->doubleSpinBox_hysteresis_4->value();
|
|
|
|
speed_data->variables_[i].events_per_revolution = ui->spinBox_events_per_revolution_4->value();
|
|
|
|
speed_data->variables_[i].record_output = ui->comboBox_record_output_4->currentIndex();
|
|
|
|
speed_data->variables_[i].two_ma_clamp = ui->checkBox_two_ma_clamp_4->isChecked();
|
|
|
|
speed_data->variables_[i].alert_latching = ui->radioButton_alert_latching_4->isChecked();
|
|
|
|
speed_data->variables_[i].overspeed_latching = ui->radioButton_overspeed_latching_4->isChecked();
|
|
|
|
}
|
2025-03-21 10:42:24 +08:00
|
|
|
}
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
|
2025-03-27 10:16:01 +08:00
|
|
|
void Tachometer::Init() {
|
2025-04-02 14:07:37 +08:00
|
|
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
|
|
|
if (base_ptr == nullptr) {
|
|
|
|
// do nothing or use template to init it.
|
|
|
|
std::shared_ptr<TachometerData> speed_data = std::make_shared<TachometerData>();
|
2025-04-10 16:45:20 +08:00
|
|
|
speed_data->card_type_ = car_type;
|
|
|
|
speed_data->slot_ = slot_no;
|
2025-04-02 14:07:37 +08:00
|
|
|
ConfigMgr::Instance()->AddCard(speed_data);
|
|
|
|
UpdateData(speed_data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
2025-04-02 09:59:55 +08:00
|
|
|
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
2025-04-02 14:07:37 +08:00
|
|
|
if (i + 1 == 1) {
|
|
|
|
ui->checkBox_chan_1->setChecked(speed_data->variables_[i].active);
|
|
|
|
ui->doubleSpinBox_high_1->setValue(speed_data->variables_[i].normal_voltage_high);
|
|
|
|
ui->doubleSpinBox_low_1->setValue(speed_data->variables_[i].normal_voltage_low);
|
|
|
|
ui->full_scale_range_1->setValue(speed_data->variables_[i].speed_peek);
|
|
|
|
ui->default_value_1->setValue(speed_data->variables_[i].default_speed);
|
|
|
|
if (speed_data->variables_[i].automatic_threshold) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_automatic_threshold_1->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_manual_threshold_1->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
ui->doubleSpinBox_threshold_1->setValue(speed_data->variables_[i].threshold);
|
|
|
|
ui->doubleSpinBox_hysteresis_1->setValue(speed_data->variables_[i].hysteresis);
|
|
|
|
ui->spinBox_events_per_revolution_1->setValue(speed_data->variables_[i].events_per_revolution);
|
|
|
|
ui->comboBox_record_output_1->setCurrentIndex(speed_data->variables_[i].record_output);
|
|
|
|
ui->checkBox_two_ma_clamp_1->setChecked(speed_data->variables_[i].two_ma_clamp);
|
|
|
|
if (speed_data->variables_[i].alert_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_1->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_1->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
if (speed_data->variables_[i].overspeed_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_1->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_1->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
} else if (i + 1 == 2) {
|
|
|
|
ui->checkBox_chan_2->setChecked(speed_data->variables_[i].active);
|
|
|
|
ui->doubleSpinBox_high_2->setValue(speed_data->variables_[i].normal_voltage_high);
|
|
|
|
ui->doubleSpinBox_low_2->setValue(speed_data->variables_[i].normal_voltage_low);
|
|
|
|
ui->full_scale_range_2->setValue(speed_data->variables_[i].speed_peek);
|
|
|
|
ui->default_value_2->setValue(speed_data->variables_[i].default_speed);
|
|
|
|
if (speed_data->variables_[i].automatic_threshold) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_automatic_threshold_2->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_manual_threshold_2->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
ui->doubleSpinBox_threshold_2->setValue(speed_data->variables_[i].threshold);
|
|
|
|
ui->doubleSpinBox_hysteresis_2->setValue(speed_data->variables_[i].hysteresis);
|
|
|
|
ui->spinBox_events_per_revolution_2->setValue(speed_data->variables_[i].events_per_revolution);
|
|
|
|
ui->comboBox_record_output_2->setCurrentIndex(speed_data->variables_[i].record_output);
|
|
|
|
ui->checkBox_two_ma_clamp_2->setChecked(speed_data->variables_[i].two_ma_clamp);
|
|
|
|
if (speed_data->variables_[i].alert_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_2->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_2->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
if (speed_data->variables_[i].overspeed_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_2->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_2->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
} else if (i + 1 == 3) {
|
|
|
|
ui->checkBox_chan_3->setChecked(speed_data->variables_[i].active);
|
|
|
|
ui->doubleSpinBox_high_3->setValue(speed_data->variables_[i].normal_voltage_high);
|
|
|
|
ui->doubleSpinBox_low_3->setValue(speed_data->variables_[i].normal_voltage_low);
|
|
|
|
ui->full_scale_range_3->setValue(speed_data->variables_[i].speed_peek);
|
|
|
|
ui->default_value_3->setValue(speed_data->variables_[i].default_speed);
|
|
|
|
if (speed_data->variables_[i].automatic_threshold) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_automatic_threshold_3->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_manual_threshold_3->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
ui->doubleSpinBox_threshold_3->setValue(speed_data->variables_[i].threshold);
|
|
|
|
ui->doubleSpinBox_hysteresis_3->setValue(speed_data->variables_[i].hysteresis);
|
|
|
|
ui->spinBox_events_per_revolution_3->setValue(speed_data->variables_[i].events_per_revolution);
|
|
|
|
ui->comboBox_record_output_3->setCurrentIndex(speed_data->variables_[i].record_output);
|
|
|
|
ui->checkBox_two_ma_clamp_3->setChecked(speed_data->variables_[i].two_ma_clamp);
|
|
|
|
if (speed_data->variables_[i].alert_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_3->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_3->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
if (speed_data->variables_[i].overspeed_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_3->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_3->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
} else if (i + 1 == 4) {
|
|
|
|
ui->checkBox_chan_4->setChecked(speed_data->variables_[i].active);
|
|
|
|
ui->doubleSpinBox_high_4->setValue(speed_data->variables_[i].normal_voltage_high);
|
|
|
|
ui->doubleSpinBox_low_4->setValue(speed_data->variables_[i].normal_voltage_low);
|
|
|
|
ui->full_scale_range_4->setValue(speed_data->variables_[i].speed_peek);
|
|
|
|
ui->default_value_4->setValue(speed_data->variables_[i].default_speed);
|
|
|
|
if (speed_data->variables_[i].automatic_threshold) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_automatic_threshold_4->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
|
|
|
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_manual_threshold_4->setChecked(true);
|
2025-04-22 10:11:18 +08:00
|
|
|
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
|
|
|
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
ui->doubleSpinBox_threshold_4->setValue(speed_data->variables_[i].threshold);
|
|
|
|
ui->doubleSpinBox_hysteresis_4->setValue(speed_data->variables_[i].hysteresis);
|
|
|
|
ui->spinBox_events_per_revolution_4->setValue(speed_data->variables_[i].events_per_revolution);
|
|
|
|
ui->comboBox_record_output_4->setCurrentIndex(speed_data->variables_[i].record_output);
|
|
|
|
ui->checkBox_two_ma_clamp_4->setChecked(speed_data->variables_[i].two_ma_clamp);
|
|
|
|
if (speed_data->variables_[i].alert_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_4->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_alert_latching_4->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
if (speed_data->variables_[i].overspeed_latching) {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_4->setCheckable(true);
|
2025-03-27 10:16:01 +08:00
|
|
|
} else {
|
2025-03-23 14:03:48 +08:00
|
|
|
ui->radioButton_overspeed_latching_4->setCheckable(false);
|
2025-03-27 10:16:01 +08:00
|
|
|
}
|
2025-03-23 14:03:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
|
2025-03-27 10:16:01 +08:00
|
|
|
void Tachometer::on_pushButton_confirm_clicked() {
|
2025-04-02 14:07:37 +08:00
|
|
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
|
|
|
if (base_ptr == nullptr) {
|
|
|
|
qCritical() << " should not be here";
|
2025-03-23 14:03:48 +08:00
|
|
|
return;
|
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
|
|
|
|
UpdateData(speed_data);
|
|
|
|
this->close();
|
2025-03-21 10:42:24 +08:00
|
|
|
}
|
2025-04-02 14:07:37 +08:00
|
|
|
|
2025-03-27 10:16:01 +08:00
|
|
|
void Tachometer::on_pushButton_cancel_clicked() {
|
|
|
|
this->close();
|
|
|
|
}
|
2025-04-22 10:11:18 +08:00
|
|
|
|
|
|
|
void Tachometer::on_radioButton_automatic_threshold_1_clicked()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|