complete keyphase codes.
This commit is contained in:
parent
fcae5b8236
commit
ae6c9fdd25
@ -7,6 +7,7 @@
|
|||||||
#include "data_config.h"
|
#include "data_config.h"
|
||||||
#include "vibrationdata.h"
|
#include "vibrationdata.h"
|
||||||
#include "tachometer_data.h"
|
#include "tachometer_data.h"
|
||||||
|
#include "keyphase_data.h"
|
||||||
|
|
||||||
ConfigMgr *ConfigMgr::instance = nullptr;
|
ConfigMgr *ConfigMgr::instance = nullptr;
|
||||||
|
|
||||||
@ -214,6 +215,19 @@ void ConfigMgr::Save() {
|
|||||||
channel_item.insert("speed_peak", ptr->variables_[cid].speed_peek);
|
channel_item.insert("speed_peak", ptr->variables_[cid].speed_peek);
|
||||||
channel_item.insert("default_speed", ptr->variables_[cid].default_speed);
|
channel_item.insert("default_speed", ptr->variables_[cid].default_speed);
|
||||||
} else if (card_type_[i] == kCardKeyphase) {
|
} else if (card_type_[i] == kCardKeyphase) {
|
||||||
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
|
||||||
|
if (base_ptr == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::shared_ptr<KeyphaseData> ptr = std::dynamic_pointer_cast<KeyphaseData>(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);
|
||||||
}
|
}
|
||||||
slot_item[QString::number(cid + 1)] = channel_item;
|
slot_item[QString::number(cid + 1)] = channel_item;
|
||||||
}
|
}
|
||||||
@ -426,6 +440,21 @@ void ConfigMgr::Load(QString filename) {
|
|||||||
}
|
}
|
||||||
cards_.push_back(speed_data);
|
cards_.push_back(speed_data);
|
||||||
} else if (card_type_[i] == kCardKeyphase) {
|
} else if (card_type_[i] == kCardKeyphase) {
|
||||||
|
std::shared_ptr<KeyphaseData> keyphase_data = std::make_shared<KeyphaseData>();
|
||||||
|
keyphase_data->slot_ = slot;
|
||||||
|
keyphase_data->card_type_ = static_cast<CardType>(card_type_[i]);
|
||||||
|
keyphase_data->version_ = temp_obj["version"].toInt();
|
||||||
|
for (int j = 0; j < CHANNEL_COUNT; ++j) {
|
||||||
|
channel = temp_obj[QString::number(j + 1)].toObject();
|
||||||
|
keyphase_data->variables_[j].active = channel["active"].toBool();
|
||||||
|
QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray();
|
||||||
|
keyphase_data->variables_[j].normal_voltage_high = voltage_range_array[1].toDouble();
|
||||||
|
keyphase_data->variables_[j].normal_voltage_low = voltage_range_array[0].toDouble();
|
||||||
|
keyphase_data->variables_[j].threshold = channel["threshold"].toDouble();
|
||||||
|
keyphase_data->variables_[j].hysteresis = channel["hysteresis"].toDouble();
|
||||||
|
keyphase_data->variables_[j].events_per_revolution = channel["events_per_revolution"].toInt();
|
||||||
|
}
|
||||||
|
cards_.push_back(keyphase_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user