add tachometer codes.

This commit is contained in:
pandx 2025-04-02 14:07:37 +08:00
parent 64bd8799fb
commit d167660911
10 changed files with 543 additions and 209 deletions

View File

@ -23,6 +23,7 @@ SOURCES += \
setpoint.cpp \ setpoint.cpp \
singlerelay.cpp \ singlerelay.cpp \
tachometer.cpp \ tachometer.cpp \
tachometer_data.cpp \
velocity.cpp \ velocity.cpp \
vibrationdata.cpp vibrationdata.cpp
@ -43,6 +44,7 @@ HEADERS += \
setpoint.h \ setpoint.h \
singlerelay.h \ singlerelay.h \
tachometer.h \ tachometer.h \
tachometer_data.h \
velocity.h \ velocity.h \
velocity_ds.h \ velocity_ds.h \
vibrationdata.h vibrationdata.h

View File

@ -6,6 +6,7 @@
#include "data_config.h" #include "data_config.h"
#include "vibrationdata.h" #include "vibrationdata.h"
#include "tachometer_data.h"
ConfigMgr *ConfigMgr::instance = nullptr; ConfigMgr *ConfigMgr::instance = nullptr;
@ -191,8 +192,28 @@ void ConfigMgr::Save() {
variables["latching"] = latching; variables["latching"] = latching;
} }
channel_item["variable"] = variables; channel_item["variable"] = variables;
} else { } else if (card_type_[i] == kCardSpeedSingle || card_type_[i] == kCardSpeedTMRPrimary) {
// TODO: save speed, keyphase std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
if (base_ptr == nullptr) {
continue;
}
std::shared_ptr<TachometerData> ptr = std::dynamic_pointer_cast<TachometerData>(base_ptr);
QJsonArray voltage_range_array;
voltage_range_array.append(ptr->variables_[cid].normal_voltage_low);
voltage_range_array.append(ptr->variables_[cid].normal_voltage_high);
channel_item.insert("active", ptr->variables_[cid].active);
channel_item.insert("normal_voltage_range", voltage_range_array);
channel_item.insert("threshold", ptr->variables_[cid].threshold);
channel_item.insert("hysteresis", ptr->variables_[cid].hysteresis);
channel_item.insert("events_per_revolution", ptr->variables_[cid].events_per_revolution);
channel_item.insert("record_output", ptr->variables_[cid].record_output);
channel_item.insert("two_ma_clamp", ptr->variables_[cid].two_ma_clamp);
channel_item.insert("alert_latching", ptr->variables_[cid].alert_latching);
channel_item.insert("overspeed_latching", ptr->variables_[cid].overspeed_latching);
channel_item.insert("normal_latching", ptr->variables_[cid].normal_latching);
channel_item.insert("speed_peak", ptr->variables_[cid].speed_peek);
channel_item.insert("default_speed", ptr->variables_[cid].default_speed);
} else if (card_type_[i] == kCardKeyphase) {
} }
slot_item[QString::number(cid + 1)] = channel_item; slot_item[QString::number(cid + 1)] = channel_item;
} }
@ -256,6 +277,9 @@ void ConfigMgr::Load(QString filename) {
temp_obj = json_obj[QString::number(slot)].toObject(); temp_obj = json_obj[QString::number(slot)].toObject();
if (card_type_[i] == kCardVibSingle) { if (card_type_[i] == kCardVibSingle) {
std::shared_ptr<VibrationData> vib_data = std::make_shared<VibrationData>(); std::shared_ptr<VibrationData> vib_data = std::make_shared<VibrationData>();
vib_data->version_ = temp_obj["version"].toInt();
vib_data->card_type_ = static_cast<CardType>(card_type_[i]);
vib_data->slot_ = slot;
for (int j = 0; j < CHANNEL_COUNT; ++j) { for (int j = 0; j < CHANNEL_COUNT; ++j) {
channel = temp_obj[QString::number(j + 1)].toObject(); channel = temp_obj[QString::number(j + 1)].toObject();
// base info // base info
@ -377,6 +401,31 @@ void ConfigMgr::Load(QString filename) {
} }
} }
cards_.push_back(vib_data); cards_.push_back(vib_data);
} else if (card_type_[i] == kCardSpeedSingle ||
card_type_[i] == kCardSpeedTMRPrimary) {
std::shared_ptr<TachometerData> speed_data = std::make_shared<TachometerData>();
speed_data->slot_ = slot;
speed_data->card_type_ = static_cast<CardType>(card_type_[i]);
speed_data->version_ = temp_obj["version"].toInt();
for (int j = 0; j < CHANNEL_COUNT; ++j) {
channel = temp_obj[QString::number(j + 1)].toObject();
speed_data->variables_[j].active = channel["active"].toBool();
QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray();
speed_data->variables_[j].normal_voltage_high = voltage_range_array[1].toDouble();
speed_data->variables_[j].normal_voltage_low = voltage_range_array[0].toDouble();
speed_data->variables_[j].threshold = channel["threshold"].toDouble();
speed_data->variables_[j].hysteresis = channel["hysteresis"].toDouble();
speed_data->variables_[j].events_per_revolution = channel["events_per_revolution"].toInt();
speed_data->variables_[j].record_output = channel["record_output"].toInt();
speed_data->variables_[j].two_ma_clamp = channel["two_ma_clamp"].toBool();
speed_data->variables_[j].alert_latching = channel["alert_latching"].toBool();
speed_data->variables_[j].overspeed_latching = channel["overspeed_latching"].toBool();
speed_data->variables_[j].normal_latching = channel["normal_latching"].toBool();
speed_data->variables_[j].speed_peek = channel["speed_peak"].toInt();
speed_data->variables_[j].default_speed = channel["default_speed"].toInt();
}
cards_.push_back(speed_data);
} else if (card_type_[i] == kCardKeyphase) {
} }
} }
} }

View File

@ -165,18 +165,18 @@ typedef struct {
bool active; bool active;
float normal_voltage_low; float normal_voltage_low;
float normal_voltage_high; float normal_voltage_high;
int speed_peek;
int default_speed;
bool automatic_threshold; bool automatic_threshold;
float threshold; float threshold;
float hysteresis; float hysteresis;
int events_per_revolution; int events_per_revolution;
QString record_output; int record_output;
bool two_ma_clamp; bool two_ma_clamp;
bool alert_latching; bool alert_latching;
bool overspeed_latching; bool overspeed_latching;
bool normal_latching; bool normal_latching;
int alert_response_time; } TachometerVariables;
int danger_response_time;
} Tachometer_Variables;
typedef struct { typedef struct {
QString transducer_name; QString transducer_name;

View File

@ -102,7 +102,7 @@ void KeyPhase::readJsonFile(const QString &filePath) {
keyphase_variables[i].threshold = temp_obj["threshold"].toDouble(); keyphase_variables[i].threshold = temp_obj["threshold"].toDouble();
keyphase_variables[i].hysteresis = temp_obj["hysteresis"].toDouble(); keyphase_variables[i].hysteresis = temp_obj["hysteresis"].toDouble();
keyphase_variables[i].events_per_revolution = temp_obj["events_per_revolution"].toInt(); keyphase_variables[i].events_per_revolution = temp_obj["events_per_revolution"].toInt();
keyphase_variables[i].record_output = temp_obj["record_output"].toString(); keyphase_variables[i].record_output = temp_obj["record_output"].toInt();
keyphase_variables[i].two_ma_clamp = temp_obj["two_ma_clamp"].toBool(); keyphase_variables[i].two_ma_clamp = temp_obj["two_ma_clamp"].toBool();
keyphase_variables[i].alert_latching = temp_obj["alert_latching"].toBool(); keyphase_variables[i].alert_latching = temp_obj["alert_latching"].toBool();
keyphase_variables[i].overspeed_latching = temp_obj["overspeed_latching"].toBool(); keyphase_variables[i].overspeed_latching = temp_obj["overspeed_latching"].toBool();

View File

@ -24,7 +24,7 @@ class KeyPhase : public QDialog {
void on_manual_threshold_4_clicked(bool checked); void on_manual_threshold_4_clicked(bool checked);
private: private:
Ui::KeyPhase *ui; Ui::KeyPhase *ui;
Tachometer_Variables keyphase_variables[4]; TachometerVariables keyphase_variables[4];
void readJsonFile(const QString &filePath); void readJsonFile(const QString &filePath);
void Init(); void Init();
}; };

View File

@ -7,6 +7,10 @@
#include <QJsonParseError> #include <QJsonParseError>
#include <QJsonArray> #include <QJsonArray>
#include "data_config.h"
#include "config_mgr.h"
#include "tachometer_data.h"
Tachometer::Tachometer(int slot_no_, QWidget *parent) Tachometer::Tachometer(int slot_no_, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::Tachometer) { , ui(new Ui::Tachometer) {
@ -16,8 +20,6 @@ Tachometer::Tachometer(int slot_no_, QWidget *parent)
slot_no = slot_no_; slot_no = slot_no_;
QString slot = QString("%1").arg(slot_no); QString slot = QString("%1").arg(slot_no);
ui->label_slot->setText(slot); ui->label_slot->setText(slot);
QString filePath_tachometer = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\tachometer.json").arg(slot_no);
readJsonFile(filePath_tachometer);
Init(); Init();
connect(ui->radioButton_manual_threshold_1, &QRadioButton::toggled, this, &Tachometer::on_manual_threshold_1_clicked); 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_2, &QRadioButton::toggled, this, &Tachometer::on_manual_threshold_2_clicked);
@ -69,142 +71,182 @@ void Tachometer::on_manual_threshold_4_clicked(bool checked) {
ui->doubleSpinBox_hysteresis_4->setEnabled(false); ui->doubleSpinBox_hysteresis_4->setEnabled(false);
} }
void Tachometer::readJsonFile(const QString &filePath) { void Tachometer::UpdateData(std::shared_ptr<TachometerData> &speed_data) {
QFile file(filePath); speed_data->card_type_ = kCardSpeedSingle;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { speed_data->slot_ = slot_no;
qDebug() << "Cannot open file for reading:" << filePath; speed_data->version_ = 1;
return; 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();
speed_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_1->isChecked();
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();
speed_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_2->isChecked();
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();
speed_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_3->isChecked();
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();
speed_data->variables_[i].automatic_threshold = ui->radioButton_automatic_threshold_4->isChecked();
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();
} }
QString content = file.readAll();
file.close();
QByteArray jsonData = content.toUtf8();
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
if (jsonDoc.isNull()) {
qDebug() << "Cannot parse JSON document";
return;
}
if (!jsonDoc.isObject() && !jsonDoc.isArray()) {
qDebug() << "JSON document is not an object or an array";
return;
}
QJsonObject json_obj = jsonDoc.object();
QJsonArray chan_array = json_obj["chan"].toArray();
for (int i = 0; i < chan_array.size(); i++) {
QJsonObject temp_obj = chan_array[i].toObject();
tachometer_variables[i].id = temp_obj["id"].toInt();
tachometer_variables[i].active = temp_obj["active"].toBool();
QJsonArray voltage_range_array = temp_obj["normal_voltage_range"].toArray();
tachometer_variables[i].normal_voltage_high = voltage_range_array[1].toDouble();
tachometer_variables[i].normal_voltage_low = voltage_range_array[0].toDouble();
tachometer_variables[i].threshold = temp_obj["threshold"].toDouble();
tachometer_variables[i].hysteresis = temp_obj["hysteresis"].toDouble();
tachometer_variables[i].events_per_revolution = temp_obj["events_per_revolution"].toInt();
tachometer_variables[i].record_output = temp_obj["record_output"].toString();
tachometer_variables[i].two_ma_clamp = temp_obj["two_ma_clamp"].toBool();
tachometer_variables[i].alert_latching = temp_obj["alert_latching"].toBool();
tachometer_variables[i].overspeed_latching = temp_obj["overspeed_latching"].toBool();
tachometer_variables[i].normal_latching = temp_obj["normal_latching"].toBool();
tachometer_variables[i].alert_response_time = temp_obj["alert_response_time"].toInt();
tachometer_variables[i].danger_response_time = temp_obj["danger_response_time"].toInt();
} }
} }
void Tachometer::Init() { void Tachometer::Init() {
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>();
ConfigMgr::Instance()->AddCard(speed_data);
UpdateData(speed_data);
return;
}
std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
for (int i = 0; i < CHANNEL_COUNT; i++) { for (int i = 0; i < CHANNEL_COUNT; i++) {
if (tachometer_variables[i].id == 1) { if (i + 1 == 1) {
ui->checkBox_chan_1->setChecked(tachometer_variables[i].active); ui->checkBox_chan_1->setChecked(speed_data->variables_[i].active);
ui->doubleSpinBox_high_1->setValue(tachometer_variables[i].normal_voltage_high); ui->doubleSpinBox_high_1->setValue(speed_data->variables_[i].normal_voltage_high);
ui->doubleSpinBox_low_1->setValue(tachometer_variables[i].normal_voltage_low); ui->doubleSpinBox_low_1->setValue(speed_data->variables_[i].normal_voltage_low);
if (tachometer_variables[i].automatic_threshold) { 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) {
ui->radioButton_automatic_threshold_1->setChecked(true); ui->radioButton_automatic_threshold_1->setChecked(true);
} else { } else {
ui->radioButton_manual_threshold_1->setChecked(true); ui->radioButton_manual_threshold_1->setChecked(true);
} }
ui->doubleSpinBox_threshold_1->setValue(tachometer_variables[i].threshold); ui->doubleSpinBox_threshold_1->setValue(speed_data->variables_[i].threshold);
ui->doubleSpinBox_hysteresis_1->setValue(tachometer_variables[i].hysteresis); ui->doubleSpinBox_hysteresis_1->setValue(speed_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_1->setValue(tachometer_variables[i].events_per_revolution); ui->spinBox_events_per_revolution_1->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_1->setCurrentText(tachometer_variables[i].record_output); ui->comboBox_record_output_1->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_1->setChecked(tachometer_variables[i].two_ma_clamp); ui->checkBox_two_ma_clamp_1->setChecked(speed_data->variables_[i].two_ma_clamp);
if (tachometer_variables[i].alert_latching) { if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_1->setCheckable(true); ui->radioButton_alert_latching_1->setCheckable(true);
} else { } else {
ui->radioButton_alert_latching_1->setCheckable(false); ui->radioButton_alert_latching_1->setCheckable(false);
} }
if (tachometer_variables[i].overspeed_latching) { if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_1->setCheckable(true); ui->radioButton_overspeed_latching_1->setCheckable(true);
} else { } else {
ui->radioButton_overspeed_latching_1->setCheckable(false); ui->radioButton_overspeed_latching_1->setCheckable(false);
} }
} } else if (i + 1 == 2) {
if (tachometer_variables[i].id == 2) { ui->checkBox_chan_2->setChecked(speed_data->variables_[i].active);
ui->checkBox_chan_2->setChecked(tachometer_variables[i].active); ui->doubleSpinBox_high_2->setValue(speed_data->variables_[i].normal_voltage_high);
ui->doubleSpinBox_high_2->setValue(tachometer_variables[i].normal_voltage_high); ui->doubleSpinBox_low_2->setValue(speed_data->variables_[i].normal_voltage_low);
ui->doubleSpinBox_low_2->setValue(tachometer_variables[i].normal_voltage_low); ui->full_scale_range_2->setValue(speed_data->variables_[i].speed_peek);
if (tachometer_variables[i].automatic_threshold) { ui->default_value_2->setValue(speed_data->variables_[i].default_speed);
if (speed_data->variables_[i].automatic_threshold) {
ui->radioButton_automatic_threshold_2->setChecked(true); ui->radioButton_automatic_threshold_2->setChecked(true);
} else { } else {
ui->radioButton_manual_threshold_2->setChecked(true); ui->radioButton_manual_threshold_2->setChecked(true);
} }
ui->doubleSpinBox_threshold_2->setValue(tachometer_variables[i].threshold); ui->doubleSpinBox_threshold_2->setValue(speed_data->variables_[i].threshold);
ui->doubleSpinBox_hysteresis_2->setValue(tachometer_variables[i].hysteresis); ui->doubleSpinBox_hysteresis_2->setValue(speed_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_2->setValue(tachometer_variables[i].events_per_revolution); ui->spinBox_events_per_revolution_2->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_2->setCurrentText(tachometer_variables[i].record_output); ui->comboBox_record_output_2->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_2->setChecked(tachometer_variables[i].two_ma_clamp); ui->checkBox_two_ma_clamp_2->setChecked(speed_data->variables_[i].two_ma_clamp);
if (tachometer_variables[i].alert_latching) { if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_2->setCheckable(true); ui->radioButton_alert_latching_2->setCheckable(true);
} else { } else {
ui->radioButton_alert_latching_2->setCheckable(false); ui->radioButton_alert_latching_2->setCheckable(false);
} }
if (tachometer_variables[i].overspeed_latching) { if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_2->setCheckable(true); ui->radioButton_overspeed_latching_2->setCheckable(true);
} else { } else {
ui->radioButton_overspeed_latching_2->setCheckable(false); ui->radioButton_overspeed_latching_2->setCheckable(false);
} }
} } else if (i + 1 == 3) {
if (tachometer_variables[i].id == 3) { ui->checkBox_chan_3->setChecked(speed_data->variables_[i].active);
ui->checkBox_chan_3->setChecked(tachometer_variables[i].active); ui->doubleSpinBox_high_3->setValue(speed_data->variables_[i].normal_voltage_high);
ui->doubleSpinBox_high_3->setValue(tachometer_variables[i].normal_voltage_high); ui->doubleSpinBox_low_3->setValue(speed_data->variables_[i].normal_voltage_low);
ui->doubleSpinBox_low_3->setValue(tachometer_variables[i].normal_voltage_low); ui->full_scale_range_3->setValue(speed_data->variables_[i].speed_peek);
if (tachometer_variables[i].automatic_threshold) { ui->default_value_3->setValue(speed_data->variables_[i].default_speed);
if (speed_data->variables_[i].automatic_threshold) {
ui->radioButton_automatic_threshold_3->setChecked(true); ui->radioButton_automatic_threshold_3->setChecked(true);
} else { } else {
ui->radioButton_manual_threshold_3->setChecked(true); ui->radioButton_manual_threshold_3->setChecked(true);
} }
ui->doubleSpinBox_threshold_3->setValue(tachometer_variables[i].threshold); ui->doubleSpinBox_threshold_3->setValue(speed_data->variables_[i].threshold);
ui->doubleSpinBox_hysteresis_3->setValue(tachometer_variables[i].hysteresis); ui->doubleSpinBox_hysteresis_3->setValue(speed_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_3->setValue(tachometer_variables[i].events_per_revolution); ui->spinBox_events_per_revolution_3->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_3->setCurrentText(tachometer_variables[i].record_output); ui->comboBox_record_output_3->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_3->setChecked(tachometer_variables[i].two_ma_clamp); ui->checkBox_two_ma_clamp_3->setChecked(speed_data->variables_[i].two_ma_clamp);
if (tachometer_variables[i].alert_latching) { if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_3->setCheckable(true); ui->radioButton_alert_latching_3->setCheckable(true);
} else { } else {
ui->radioButton_alert_latching_3->setCheckable(false); ui->radioButton_alert_latching_3->setCheckable(false);
} }
if (tachometer_variables[i].overspeed_latching) { if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_3->setCheckable(true); ui->radioButton_overspeed_latching_3->setCheckable(true);
} else { } else {
ui->radioButton_overspeed_latching_3->setCheckable(false); ui->radioButton_overspeed_latching_3->setCheckable(false);
} }
} } else if (i + 1 == 4) {
if (tachometer_variables[i].id == 4) { ui->checkBox_chan_4->setChecked(speed_data->variables_[i].active);
ui->checkBox_chan_4->setChecked(tachometer_variables[i].active); ui->doubleSpinBox_high_4->setValue(speed_data->variables_[i].normal_voltage_high);
ui->doubleSpinBox_high_4->setValue(tachometer_variables[i].normal_voltage_high); ui->doubleSpinBox_low_4->setValue(speed_data->variables_[i].normal_voltage_low);
ui->doubleSpinBox_low_4->setValue(tachometer_variables[i].normal_voltage_low); ui->full_scale_range_4->setValue(speed_data->variables_[i].speed_peek);
if (tachometer_variables[i].automatic_threshold) { ui->default_value_4->setValue(speed_data->variables_[i].default_speed);
if (speed_data->variables_[i].automatic_threshold) {
ui->radioButton_automatic_threshold_4->setChecked(true); ui->radioButton_automatic_threshold_4->setChecked(true);
} else { } else {
ui->radioButton_manual_threshold_4->setChecked(true); ui->radioButton_manual_threshold_4->setChecked(true);
} }
ui->doubleSpinBox_threshold_4->setValue(tachometer_variables[i].threshold); ui->doubleSpinBox_threshold_4->setValue(speed_data->variables_[i].threshold);
ui->doubleSpinBox_hysteresis_4->setValue(tachometer_variables[i].hysteresis); ui->doubleSpinBox_hysteresis_4->setValue(speed_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_4->setValue(tachometer_variables[i].events_per_revolution); ui->spinBox_events_per_revolution_4->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_4->setCurrentText(tachometer_variables[i].record_output); ui->comboBox_record_output_4->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_4->setChecked(tachometer_variables[i].two_ma_clamp); ui->checkBox_two_ma_clamp_4->setChecked(speed_data->variables_[i].two_ma_clamp);
if (tachometer_variables[i].alert_latching) { if (speed_data->variables_[i].alert_latching) {
ui->radioButton_alert_latching_4->setCheckable(true); ui->radioButton_alert_latching_4->setCheckable(true);
} else { } else {
ui->radioButton_alert_latching_4->setCheckable(false); ui->radioButton_alert_latching_4->setCheckable(false);
} }
if (tachometer_variables[i].overspeed_latching) { if (speed_data->variables_[i].overspeed_latching) {
ui->radioButton_overspeed_latching_4->setCheckable(true); ui->radioButton_overspeed_latching_4->setCheckable(true);
} else { } else {
ui->radioButton_overspeed_latching_4->setCheckable(false); ui->radioButton_overspeed_latching_4->setCheckable(false);
@ -212,100 +254,18 @@ void Tachometer::Init() {
} }
} }
} }
void Tachometer::on_pushButton_confirm_clicked() { void Tachometer::on_pushButton_confirm_clicked() {
for (int i = 0; i < CHANNEL_COUNT; i++) { std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (tachometer_variables[i].id == 1) { if (base_ptr == nullptr) {
tachometer_variables[i].active = ui->checkBox_chan_1->isChecked(); qCritical() << " should not be here";
tachometer_variables[i].normal_voltage_high = ui->doubleSpinBox_high_1->value();
tachometer_variables[i].normal_voltage_low = ui->doubleSpinBox_low_1->value();
tachometer_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_1->isChecked();
tachometer_variables[i].threshold = ui->doubleSpinBox_threshold_1->value();
tachometer_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_1->value();
tachometer_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_1->value();
tachometer_variables[i].record_output = ui->comboBox_record_output_1->currentText();
tachometer_variables[i].two_ma_clamp = ui->checkBox_two_ma_clamp_1->isChecked();
tachometer_variables[i].alert_latching = ui->radioButton_alert_latching_1->isChecked();
tachometer_variables[i].overspeed_latching = ui->radioButton_overspeed_latching_1->isChecked();
}
if (tachometer_variables[i].id == 2) {
tachometer_variables[i].active = ui->checkBox_chan_2->isChecked();
tachometer_variables[i].normal_voltage_high = ui->doubleSpinBox_high_2->value();
tachometer_variables[i].normal_voltage_low = ui->doubleSpinBox_low_2->value();
tachometer_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_2->isChecked();
tachometer_variables[i].threshold = ui->doubleSpinBox_threshold_2->value();
tachometer_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_2->value();
tachometer_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_2->value();
tachometer_variables[i].record_output = ui->comboBox_record_output_2->currentText();
tachometer_variables[i].two_ma_clamp = ui->checkBox_two_ma_clamp_2->isChecked();
tachometer_variables[i].alert_latching = ui->radioButton_alert_latching_2->isChecked();
tachometer_variables[i].overspeed_latching = ui->radioButton_overspeed_latching_2->isChecked();
}
if (tachometer_variables[i].id == 3) {
tachometer_variables[i].active = ui->checkBox_chan_3->isChecked();
tachometer_variables[i].normal_voltage_high = ui->doubleSpinBox_high_3->value();
tachometer_variables[i].normal_voltage_low = ui->doubleSpinBox_low_3->value();
tachometer_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_3->isChecked();
tachometer_variables[i].threshold = ui->doubleSpinBox_threshold_3->value();
tachometer_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_3->value();
tachometer_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_3->value();
tachometer_variables[i].record_output = ui->comboBox_record_output_3->currentText();
tachometer_variables[i].two_ma_clamp = ui->checkBox_two_ma_clamp_3->isChecked();
tachometer_variables[i].alert_latching = ui->radioButton_alert_latching_3->isChecked();
tachometer_variables[i].overspeed_latching = ui->radioButton_overspeed_latching_3->isChecked();
}
if (tachometer_variables[i].id == 4) {
tachometer_variables[i].active = ui->checkBox_chan_4->isChecked();
tachometer_variables[i].normal_voltage_high = ui->doubleSpinBox_high_4->value();
tachometer_variables[i].normal_voltage_low = ui->doubleSpinBox_low_4->value();
tachometer_variables[i].automatic_threshold = ui->radioButton_automatic_threshold_4->isChecked();
tachometer_variables[i].threshold = ui->doubleSpinBox_threshold_4->value();
tachometer_variables[i].hysteresis = ui->doubleSpinBox_hysteresis_4->value();
tachometer_variables[i].events_per_revolution = ui->spinBox_events_per_revolution_4->value();
tachometer_variables[i].record_output = ui->comboBox_record_output_4->currentText();
tachometer_variables[i].two_ma_clamp = ui->checkBox_two_ma_clamp_4->isChecked();
tachometer_variables[i].alert_latching = ui->radioButton_alert_latching_4->isChecked();
tachometer_variables[i].overspeed_latching = ui->radioButton_overspeed_latching_4->isChecked();
}
}
QString slot = QString("%1").arg(slot_no);
QString filePath_tachometer = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\tachometer.json").arg(slot_no);
QFile file(filePath_tachometer);
if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "Could not open file for writing";
return; return;
} }
QJsonObject json_obj; std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
QJsonArray chan_array; UpdateData(speed_data);
for (int i = 0; i < CHANNEL_COUNT; i++) { this->close();
QJsonObject temp_obj;
temp_obj.insert("id", tachometer_variables[i].id);
temp_obj.insert("active", tachometer_variables[i].active);
QJsonArray voltage_range_array;
voltage_range_array.append(tachometer_variables[i].normal_voltage_low);
voltage_range_array.append(tachometer_variables[i].normal_voltage_high);
temp_obj.insert("normal_voltage_range", voltage_range_array);
temp_obj.insert("threshold", tachometer_variables[i].threshold);
temp_obj.insert("hysteresis", tachometer_variables[i].hysteresis);
temp_obj.insert("events_per_revolution", tachometer_variables[i].events_per_revolution);
temp_obj.insert("record_output", tachometer_variables[i].record_output);
temp_obj.insert("two_ma_clamp", tachometer_variables[i].two_ma_clamp);
temp_obj.insert("alert_latching", tachometer_variables[i].alert_latching);
temp_obj.insert("overspeed_latching", tachometer_variables[i].overspeed_latching);
temp_obj.insert("normal_latching", tachometer_variables[i].normal_latching);
temp_obj.insert("alert_response_time", tachometer_variables[i].alert_response_time);
temp_obj.insert("danger_response_time", tachometer_variables[i].danger_response_time);
chan_array.append(temp_obj);
}
json_obj.insert("chan", chan_array);
json_obj.insert("version", 1);
json_obj.insert("slot", slot_no);
json_obj.insert("card_type", 2);
QJsonDocument json_doc;
json_doc.setObject(json_obj);
QByteArray byte_array = json_doc.toJson();
file.write(byte_array);
file.close();
} }
void Tachometer::on_pushButton_cancel_clicked() { void Tachometer::on_pushButton_cancel_clicked() {
this->close(); this->close();
} }

View File

@ -3,6 +3,8 @@
#include <QDialog> #include <QDialog>
#include "data_config.h" #include "data_config.h"
#include "config_mgr.h"
#include "tachometer_data.h"
namespace Ui { namespace Ui {
class Tachometer; class Tachometer;
} }
@ -23,10 +25,10 @@ class Tachometer : public QDialog {
void on_manual_threshold_4_clicked(bool checked); void on_manual_threshold_4_clicked(bool checked);
private: private:
Ui::Tachometer *ui; Ui::Tachometer *ui;
void UpdateData(std::shared_ptr<TachometerData> &speed_data);
// Tachometer_Variables tachometer_variables[4];
Tachometer_Variables tachometer_variables[4]; // void readJsonFile(const QString &filePath);
void readJsonFile(const QString &filePath);
void Init(); void Init();
}; };

View File

@ -344,7 +344,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>1 - 255</string> <string>1 - 10000</string>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_10"> <widget class="QGroupBox" name="groupBox_10">
@ -503,7 +503,7 @@
<double>50.000000000000000</double> <double>50.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>2.000000000000000</double> <double>0.500000000000000</double>
</property> </property>
</widget> </widget>
</widget> </widget>
@ -621,7 +621,7 @@
<rect> <rect>
<x>60</x> <x>60</x>
<y>310</y> <y>310</y>
<width>51</width> <width>71</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -629,13 +629,13 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>255</number> <number>10000</number>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_6"> <widget class="QGroupBox" name="groupBox_6">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>310</x> <x>480</x>
<y>10</y> <y>10</y>
<width>191</width> <width>191</width>
<height>91</height> <height>91</height>
@ -755,6 +755,77 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>191</width>
<height>71</height>
</rect>
</property>
<property name="title">
<string>转速</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>40</x>
<y>17</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>上限</string>
</property>
</widget>
<widget class="QLabel" name="label_19">
<property name="geometry">
<rect>
<x>120</x>
<y>20</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>默认值</string>
</property>
</widget>
<widget class="QSpinBox" name="full_scale_range_1">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>5000</number>
</property>
</widget>
<widget class="QSpinBox" name="default_value_1">
<property name="geometry">
<rect>
<x>120</x>
<y>40</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
@ -929,7 +1000,7 @@
<rect> <rect>
<x>60</x> <x>60</x>
<y>310</y> <y>310</y>
<width>51</width> <width>81</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -937,7 +1008,7 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>255</number> <number>10000</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_31"> <widget class="QLabel" name="label_31">
@ -950,7 +1021,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>1 - 255</string> <string>1 - 10000</string>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_7"> <widget class="QGroupBox" name="groupBox_7">
@ -1053,7 +1124,7 @@
<widget class="QGroupBox" name="groupBox_16"> <widget class="QGroupBox" name="groupBox_16">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>310</x> <x>480</x>
<y>20</y> <y>20</y>
<width>191</width> <width>191</width>
<height>91</height> <height>91</height>
@ -1135,6 +1206,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_alert_response_time_2"> <widget class="QLineEdit" name="lineEdit_alert_response_time_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -1151,6 +1225,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_danger_response_time_2"> <widget class="QLineEdit" name="lineEdit_danger_response_time_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -1321,6 +1398,77 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_17">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>191</width>
<height>71</height>
</rect>
</property>
<property name="title">
<string>转速</string>
</property>
<widget class="QLabel" name="label_20">
<property name="geometry">
<rect>
<x>40</x>
<y>17</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>上限</string>
</property>
</widget>
<widget class="QLabel" name="label_21">
<property name="geometry">
<rect>
<x>120</x>
<y>20</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>默认值</string>
</property>
</widget>
<widget class="QSpinBox" name="full_scale_range_2">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>5000</number>
</property>
</widget>
<widget class="QSpinBox" name="default_value_2">
<property name="geometry">
<rect>
<x>120</x>
<y>40</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
@ -1495,7 +1643,7 @@
<rect> <rect>
<x>60</x> <x>60</x>
<y>310</y> <y>310</y>
<width>51</width> <width>71</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -1503,7 +1651,7 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>255</number> <number>10000</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_39"> <widget class="QLabel" name="label_39">
@ -1516,7 +1664,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>1 - 255</string> <string>1 - 10000</string>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_22"> <widget class="QGroupBox" name="groupBox_22">
@ -1619,7 +1767,7 @@
<widget class="QGroupBox" name="groupBox_25"> <widget class="QGroupBox" name="groupBox_25">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>310</x> <x>480</x>
<y>20</y> <y>20</y>
<width>191</width> <width>191</width>
<height>91</height> <height>91</height>
@ -1701,6 +1849,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_alert_response_time_3"> <widget class="QLineEdit" name="lineEdit_alert_response_time_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -1717,6 +1868,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_danger_response_time_3"> <widget class="QLineEdit" name="lineEdit_danger_response_time_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -1887,6 +2041,77 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_26">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>191</width>
<height>71</height>
</rect>
</property>
<property name="title">
<string>转速</string>
</property>
<widget class="QLabel" name="label_46">
<property name="geometry">
<rect>
<x>40</x>
<y>17</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>上限</string>
</property>
</widget>
<widget class="QLabel" name="label_47">
<property name="geometry">
<rect>
<x>120</x>
<y>20</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>默认值</string>
</property>
</widget>
<widget class="QSpinBox" name="full_scale_range_3">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>5000</number>
</property>
</widget>
<widget class="QSpinBox" name="default_value_3">
<property name="geometry">
<rect>
<x>120</x>
<y>40</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_4"> <widget class="QWidget" name="tab_4">
<attribute name="title"> <attribute name="title">
@ -2056,7 +2281,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>1 - 255</string> <string>1 - 10000</string>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="spinBox_events_per_revolution_4"> <widget class="QSpinBox" name="spinBox_events_per_revolution_4">
@ -2064,7 +2289,7 @@
<rect> <rect>
<x>60</x> <x>60</x>
<y>310</y> <y>310</y>
<width>51</width> <width>71</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -2072,7 +2297,7 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>255</number> <number>10000</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_45"> <widget class="QLabel" name="label_45">
@ -2188,7 +2413,7 @@
<widget class="QGroupBox" name="groupBox_34"> <widget class="QGroupBox" name="groupBox_34">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>310</x> <x>490</x>
<y>20</y> <y>20</y>
<width>191</width> <width>191</width>
<height>91</height> <height>91</height>
@ -2270,6 +2495,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_alert_response_time_4"> <widget class="QLineEdit" name="lineEdit_alert_response_time_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -2286,6 +2514,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="lineEdit_danger_response_time_4"> <widget class="QLineEdit" name="lineEdit_danger_response_time_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>180</x>
@ -2456,6 +2687,77 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_35">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>191</width>
<height>71</height>
</rect>
</property>
<property name="title">
<string>转速</string>
</property>
<widget class="QLabel" name="label_48">
<property name="geometry">
<rect>
<x>40</x>
<y>17</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>上限</string>
</property>
</widget>
<widget class="QLabel" name="label_49">
<property name="geometry">
<rect>
<x>120</x>
<y>20</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>默认值</string>
</property>
</widget>
<widget class="QSpinBox" name="full_scale_range_4">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>5000</number>
</property>
</widget>
<widget class="QSpinBox" name="default_value_4">
<property name="geometry">
<rect>
<x>120</x>
<y>40</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</widget>
</widget> </widget>
</widget> </widget>
<widget class="QCheckBox" name="checkBox_chan_2"> <widget class="QCheckBox" name="checkBox_chan_2">
@ -2518,8 +2820,8 @@
<resources/> <resources/>
<connections/> <connections/>
<buttongroups> <buttongroups>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/> <buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup"/> <buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_2"/>
</buttongroups> </buttongroups>
</ui> </ui>

6
tachometer_data.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "tachometer_data.h"
TachometerData::TachometerData()
{
}

13
tachometer_data.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef TACHOMETERDATA_H
#define TACHOMETERDATA_H
#include "cardbase.h"
class TachometerData : public CardBase {
public:
TachometerData();
TachometerVariables variables_[4];
};
#endif // TACHOMETERDATA_H