fix build issue.
This commit is contained in:
parent
70d34a54a2
commit
e952ec06a5
@ -25,10 +25,6 @@ Acceleration::Acceleration(int slot_no_, int channel_, bool active, QWidget *par
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
}
|
||||
// QString filePath_filter = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
// readJsonFile(filePath_filter);
|
||||
// QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\acceleration_variables_%2.json").arg(slot_no).arg(channel);
|
||||
// readJsonFile(filePath_variables);
|
||||
Init();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cardbase.h"
|
||||
|
||||
CardBase::CardBase()
|
||||
{
|
||||
//CardBase::CardBase()
|
||||
//{
|
||||
|
||||
}
|
||||
//}
|
||||
|
@ -59,29 +59,29 @@ void ConfigMgr::Save() {
|
||||
voltage_range.append(ptr->base_config_[cid].normal_voltage_low);
|
||||
voltage_range.append(ptr->base_config_[cid].normal_voltage_high);
|
||||
channel_item["normal_voltage_range"] = voltage_range;
|
||||
// filter
|
||||
QJsonArray filter;
|
||||
QJsonObject low_pass;
|
||||
low_pass["low"] = ptr->filter_[cid].filter[0].low;
|
||||
low_pass["high"] = ptr->filter_[cid].filter[0].high;
|
||||
low_pass["checked"] = ptr->filter_[cid].filter[0].checked;
|
||||
filter.append(low_pass);
|
||||
QJsonObject high_pass;
|
||||
high_pass["low"] = ptr->filter_[cid].filter[1].low;
|
||||
high_pass["high"] = ptr->filter_[cid].filter[1].high;
|
||||
high_pass["checked"] = ptr->filter_[cid].filter[1].checked;
|
||||
filter.append(high_pass);
|
||||
QJsonObject band_pass;
|
||||
band_pass["low"] = ptr->filter_[cid].filter[2].low;
|
||||
band_pass["high"] = ptr->filter_[cid].filter[2].high;
|
||||
band_pass["checked"] = ptr->filter_[cid].filter[2].checked;
|
||||
filter.append(band_pass);
|
||||
channel_item["filter"] = filter;
|
||||
// variables
|
||||
QJsonObject variables;
|
||||
std::shared_ptr<VariableBase> base_channel_ptr = ptr->GetChannelPtr(cid + 1);
|
||||
if (base_channel_ptr->type_ == kVibRadial) {
|
||||
std::shared_ptr<RadialVariable> radial_ptr = std::dynamic_pointer_cast<RadialVariable>(base_channel_ptr);
|
||||
// filter
|
||||
QJsonArray filter;
|
||||
QJsonObject low_pass;
|
||||
low_pass["low"] = radial_ptr->filter_[0].low;
|
||||
low_pass["high"] = radial_ptr->filter_[0].high;
|
||||
low_pass["checked"] = radial_ptr->filter_[0].checked;
|
||||
filter.append(low_pass);
|
||||
QJsonObject high_pass;
|
||||
high_pass["low"] = radial_ptr->filter_[1].low;
|
||||
high_pass["high"] = radial_ptr->filter_[1].high;
|
||||
high_pass["checked"] = radial_ptr->filter_[1].checked;
|
||||
filter.append(high_pass);
|
||||
QJsonObject band_pass;
|
||||
band_pass["low"] = radial_ptr->filter_[2].low;
|
||||
band_pass["high"] = radial_ptr->filter_[2].high;
|
||||
band_pass["checked"] = radial_ptr->filter_[2].checked;
|
||||
filter.append(band_pass);
|
||||
channel_item["filter"] = filter;
|
||||
QJsonObject direct;
|
||||
QJsonObject x1;
|
||||
QJsonObject x2;
|
||||
@ -131,6 +131,24 @@ void ConfigMgr::Save() {
|
||||
variables["latching"] = latching;
|
||||
} else {
|
||||
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
|
||||
// filter
|
||||
QJsonArray filter;
|
||||
QJsonObject low_pass;
|
||||
low_pass["low"] = av_ptr->filter_[0].low;
|
||||
low_pass["high"] = av_ptr->filter_[0].high;
|
||||
low_pass["checked"] = av_ptr->filter_[0].checked;
|
||||
filter.append(low_pass);
|
||||
QJsonObject high_pass;
|
||||
high_pass["low"] = av_ptr->filter_[1].low;
|
||||
high_pass["high"] = av_ptr->filter_[1].high;
|
||||
high_pass["checked"] = av_ptr->filter_[1].checked;
|
||||
filter.append(high_pass);
|
||||
QJsonObject band_pass;
|
||||
band_pass["low"] = av_ptr->filter_[2].low;
|
||||
band_pass["high"] = av_ptr->filter_[2].high;
|
||||
band_pass["checked"] = av_ptr->filter_[2].checked;
|
||||
filter.append(band_pass);
|
||||
channel_item["filter"] = filter;
|
||||
QJsonObject direct;
|
||||
QJsonObject x1;
|
||||
QJsonObject x2;
|
||||
@ -252,19 +270,19 @@ void ConfigMgr::Load(QString filename) {
|
||||
QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray();
|
||||
vib_data->base_config_[j].normal_voltage_low = voltage_range_array[0].toDouble();
|
||||
vib_data->base_config_[j].normal_voltage_high = voltage_range_array[1].toDouble();
|
||||
// filter
|
||||
QJsonArray filter_array = channel["filter"].toArray();
|
||||
for (int k = 0; k < filter_array.size(); k++) {
|
||||
QJsonObject filter_ele = filter_array[i].toObject();
|
||||
vib_data->filter_[j].filter[k].low = filter_ele["low"].toInt();
|
||||
vib_data->filter_[j].filter[k].high = filter_ele["high"].toInt();
|
||||
vib_data->filter_[j].filter[k].checked = filter_ele["checked"].toBool();
|
||||
}
|
||||
// variables
|
||||
QJsonObject tmp_variable = channel["variable"].toObject();
|
||||
switch (vib_data->base_config_[j].channel_type) {
|
||||
case kVibRadial: {
|
||||
std::shared_ptr<RadialVariable> variable = std::make_shared<RadialVariable>();
|
||||
// filter
|
||||
QJsonArray filter_array = channel["filter"].toArray();
|
||||
for (int k = 0; k < filter_array.size(); k++) {
|
||||
QJsonObject filter_ele = filter_array[i].toObject();
|
||||
variable->filter_[k].low = filter_ele["low"].toInt();
|
||||
variable->filter_[k].high = filter_ele["high"].toInt();
|
||||
variable->filter_[k].checked = filter_ele["checked"].toBool();
|
||||
}
|
||||
variable->id_ = j + 1;
|
||||
QJsonObject direct = tmp_variable["direct"].toObject();
|
||||
variable->direct_.full_scale_range = direct["full_scale_range"].toInt();
|
||||
@ -311,6 +329,14 @@ void ConfigMgr::Load(QString filename) {
|
||||
case kVibVelocity:
|
||||
case kVibAcc: {
|
||||
std::shared_ptr<AccVelVariable> variable = std::make_shared<AccVelVariable>();
|
||||
// filter
|
||||
QJsonArray filter_array = channel["filter"].toArray();
|
||||
for (int k = 0; k < filter_array.size(); k++) {
|
||||
QJsonObject filter_ele = filter_array[i].toObject();
|
||||
variable->filter_[k].low = filter_ele["low"].toInt();
|
||||
variable->filter_[k].high = filter_ele["high"].toInt();
|
||||
variable->filter_[k].checked = filter_ele["checked"].toBool();
|
||||
}
|
||||
variable->id_ = j + 1;
|
||||
QJsonObject direct = tmp_variable["direct"].toObject();
|
||||
variable->direct_.full_scale_range = direct["full_scale_range"].toInt();
|
||||
|
@ -110,7 +110,7 @@ void KeyPhase::readJsonFile(const QString &filePath) {
|
||||
}
|
||||
}
|
||||
void KeyPhase::Init() {
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if (keyphase_variables[i].id == 1) {
|
||||
ui->checkBox_enable_1->setChecked(keyphase_variables[i].active);
|
||||
ui->doubleSpinBox_high_1->setValue(keyphase_variables[i].normal_voltage_high);
|
||||
@ -166,7 +166,7 @@ void KeyPhase::Init() {
|
||||
}
|
||||
}
|
||||
void KeyPhase::on_pushButton_confirm_clicked() {
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if (keyphase_variables[i].id == 1) {
|
||||
keyphase_variables[i].active = ui->checkBox_enable_1->isChecked();
|
||||
keyphase_variables[i].normal_voltage_high = ui->doubleSpinBox_high_1->value();
|
||||
@ -213,7 +213,7 @@ void KeyPhase::on_pushButton_confirm_clicked() {
|
||||
}
|
||||
QJsonObject json_obj;
|
||||
QJsonArray chan_array;
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("id", keyphase_variables[i].id);
|
||||
temp_obj.insert("active", keyphase_variables[i].active);
|
||||
|
@ -25,10 +25,6 @@ Radial_vibration::Radial_vibration(int slot_no_, int channel_, bool active, QWid
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
}
|
||||
// QString filePath_filter = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
// readJsonFile(filePath_filter);
|
||||
// QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\radial_vibration_variables_%2.json").arg(slot_no).arg(channel);
|
||||
// readJsonFile(filePath_variables);
|
||||
Init();
|
||||
}
|
||||
|
||||
@ -84,76 +80,6 @@ void Radial_vibration::on_checkBox_smax_ampl_toggled(bool checked) {
|
||||
ui->doubleSpinBox_smax_clamp->setEnabled(false);
|
||||
}
|
||||
|
||||
//void Radial_vibration::readJsonFile(const QString &filePath) {
|
||||
// // 创建文件对象
|
||||
// QFile file(filePath);
|
||||
// if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// qDebug() << "Cannot open file for reading:" << filePath;
|
||||
// return;
|
||||
// }
|
||||
// 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();
|
||||
// if (filePath.contains("filter_")) {
|
||||
// QJsonArray filter_array = json_obj["filter"].toArray();
|
||||
// for (int i = 0; i < filter_array.size(); i++) {
|
||||
// QJsonObject temp_obj = filter_array[i].toObject();
|
||||
// filter[i].type = temp_obj["type"].toString();
|
||||
// filter[i].low = temp_obj["low"].toInt();
|
||||
// filter[i].high = temp_obj["high"].toInt();
|
||||
// filter[i].checked = temp_obj["checked"].toBool();
|
||||
// }
|
||||
// } else if (filePath.contains("radial_vibration_variables_")) {
|
||||
// QJsonArray variables_array = json_obj["variables"].toArray();
|
||||
// for (int i = 0; i < variables_array.size(); i++) {
|
||||
// QJsonObject temp_obj = variables_array[i].toObject();
|
||||
// variables[i].type = temp_obj["type"].toString();
|
||||
// if (variables[i].type == "direct") {
|
||||
// variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
|
||||
// variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
// } else if (variables[i].type == "bias_volt") {
|
||||
// variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
// variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
|
||||
// } else if (variables[i].type == "1x_ampl" || variables[i].type == "2x_ampl") {
|
||||
// variables[i].checked = temp_obj["checked"].toBool();
|
||||
// variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
|
||||
// variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
// variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
|
||||
// } else if (variables[i].type == "not_1x_ampl") {
|
||||
// variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
// variables[i].checked = temp_obj["checked"].toBool();
|
||||
// variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
|
||||
// } else if (variables[i].type == "smax_ampl") {
|
||||
// variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
|
||||
// variables[i].checked = temp_obj["checked"].toBool();
|
||||
// variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
|
||||
// }
|
||||
// }
|
||||
// QJsonObject delay_obj = json_obj["delay"].toObject();
|
||||
// delay.alert = delay_obj["alert"].toInt();
|
||||
// delay.danger = delay_obj["danger"].toDouble();
|
||||
// delay.active_100ms = delay_obj["active_100ms"].toBool();
|
||||
// alert_variables.alert_latching = json_obj["alert_latching"].toBool();
|
||||
// alert_variables.danger_latching = json_obj["danger_latching"].toBool();
|
||||
// alert_variables.timed_ok = json_obj["timed_ok"].toBool();
|
||||
// alert_variables.recorder_output = json_obj["recorder_output"].toInt();
|
||||
// alert_variables.two_ma_clamp = json_obj["two_ma_clamp"].toBool();
|
||||
// alert_variables.trip_multiply = json_obj["trip_multiply"].toDouble();
|
||||
// alert_variables.comparision = json_obj["comparision"].toString();
|
||||
// alert_variables.comparision_percentage = json_obj["comparision_percentage"].toInt();
|
||||
// }
|
||||
//}
|
||||
|
||||
void Radial_vibration::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
|
@ -109,7 +109,7 @@ void Tachometer::readJsonFile(const QString &filePath) {
|
||||
}
|
||||
}
|
||||
void Tachometer::Init() {
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if (tachometer_variables[i].id == 1) {
|
||||
ui->checkBox_chan_1->setChecked(tachometer_variables[i].active);
|
||||
ui->doubleSpinBox_high_1->setValue(tachometer_variables[i].normal_voltage_high);
|
||||
@ -213,7 +213,7 @@ void Tachometer::Init() {
|
||||
}
|
||||
}
|
||||
void Tachometer::on_pushButton_confirm_clicked() {
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if (tachometer_variables[i].id == 1) {
|
||||
tachometer_variables[i].active = ui->checkBox_chan_1->isChecked();
|
||||
tachometer_variables[i].normal_voltage_high = ui->doubleSpinBox_high_1->value();
|
||||
@ -276,7 +276,7 @@ void Tachometer::on_pushButton_confirm_clicked() {
|
||||
}
|
||||
QJsonObject json_obj;
|
||||
QJsonArray chan_array;
|
||||
for (int i = 0; i < CHANNLE_COUNT; i++) {
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
QJsonObject temp_obj;
|
||||
temp_obj.insert("id", tachometer_variables[i].id);
|
||||
temp_obj.insert("active", tachometer_variables[i].active);
|
||||
|
@ -25,10 +25,6 @@ Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent)
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
}
|
||||
// QString filePath_filter = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\filter_%2.json").arg(slot_no).arg(channel);
|
||||
// readJsonFile(filePath_filter);
|
||||
// QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\velocity_variables_%2.json").arg(slot_no).arg(channel);
|
||||
// readJsonFile(filePath_variables);
|
||||
Init();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user