mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
NEW: support restore calibration status of printer
1.store each printer's calibration status to appconfig. 2.add retraction calibration 3.add choose fine calibration directly at flowrate calibration 4.add start pages for every calibration 5.add history window for pa calibration Change-Id: I117fd46e689e0573e70e8579f5a52ba62d99f3d6
This commit is contained in:
parent
cacd42f4e0
commit
e2934516ed
14 changed files with 1134 additions and 504 deletions
|
@ -508,6 +508,15 @@ std::string AppConfig::load()
|
|||
m_storage[it.key()][iter.key()] = iter.value().get<std::string>();
|
||||
}
|
||||
}
|
||||
} else if (it.key() == "calis") {
|
||||
for (auto &j : it.value()) {
|
||||
PrinterCaliInfo cali_info;
|
||||
cali_info.dev_id = j["dev_id"].get<std::string>();
|
||||
cali_info.mode = CalibMode(j["cali_mode"].get<int>());
|
||||
cali_info.state = CalibState(j["cali_state"].get<int>());
|
||||
cali_info.filament_preset = j["preset"].get<std::string>();
|
||||
m_printer_cali_infos.emplace_back(cali_info);
|
||||
}
|
||||
} else {
|
||||
if (it.value().is_object()) {
|
||||
for (auto iter = it.value().begin(); iter != it.value().end(); iter++) {
|
||||
|
@ -613,6 +622,15 @@ void AppConfig::save()
|
|||
j["app"]["filament_colors"].push_back(filament_color);
|
||||
}
|
||||
|
||||
for (const auto &cali_info : m_printer_cali_infos) {
|
||||
json json;
|
||||
json["dev_id"] = cali_info.dev_id;
|
||||
json["cali_mode"] = int(cali_info.mode);
|
||||
json["cali_state"] = int(cali_info.state);
|
||||
json["preset"] = cali_info.filament_preset;
|
||||
j["calis"].push_back(json);
|
||||
}
|
||||
|
||||
// Write the other categories.
|
||||
for (const auto& category : m_storage) {
|
||||
if (category.first.empty())
|
||||
|
@ -939,6 +957,22 @@ void AppConfig::set_vendors(const AppConfig &from)
|
|||
m_dirty = true;
|
||||
}
|
||||
|
||||
void AppConfig::save_printer_cali_infos(const PrinterCaliInfo &cali_info)
|
||||
{
|
||||
auto iter = std::find_if(m_printer_cali_infos.begin(), m_printer_cali_infos.end(), [&cali_info](const PrinterCaliInfo &cali_info_item) {
|
||||
return cali_info_item.dev_id == cali_info.dev_id;
|
||||
});
|
||||
|
||||
if (iter == m_printer_cali_infos.end()) {
|
||||
m_printer_cali_infos.emplace_back(cali_info);
|
||||
} else {
|
||||
(*iter).filament_preset = cali_info.filament_preset;
|
||||
(*iter).mode = cali_info.mode;
|
||||
(*iter).state = cali_info.state;
|
||||
}
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
std::string AppConfig::get_last_dir() const
|
||||
{
|
||||
const auto it = m_storage.find("recent");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue