ENH: remember the filament_opts and limit minimum flushing volumes

Change-Id: I7b2538fcaf5b5fc5e4f86191207de981bd766a89
(cherry picked from commit 392be8d2a4e9465fffc4018da77c6ee00ad46ade)
This commit is contained in:
zhimin.zeng 2022-10-25 18:47:58 +08:00 committed by Lane.Wei
parent eb80720e75
commit 13df80ffb7
8 changed files with 99 additions and 3 deletions

View file

@ -482,7 +482,14 @@ std::string AppConfig::load()
} else {
m_storage[it.key()][iter.key()] = "false";
}
} else {
} else if (iter.key() == "filament_presets") {
m_filament_presets = iter.value().get<std::vector<std::string>>();
} else if (iter.key() == "filament_colors") {
m_filament_colors = iter.value().get<std::vector<std::string>>();
} else if (iter.key() == "flushing_volumes") {
m_flush_volumes_matrix = iter.value().get<std::vector<float>>();
}
else {
if (iter.value().is_string())
m_storage[it.key()][iter.key()] = iter.value().get<std::string>();
else {
@ -565,6 +572,18 @@ void AppConfig::save()
j["app"][kvp.first] = kvp.second;
}
for (const auto &filament_preset : m_filament_presets) {
j["app"]["filament_presets"].push_back(filament_preset);
}
for (const auto &filament_color : m_filament_colors) {
j["app"]["filament_colors"].push_back(filament_color);
}
for (double flushing_volume : m_flush_volumes_matrix) {
j["app"]["flushing_volumes"].push_back(flushing_volume);
}
// Write the other categories.
for (const auto& category : m_storage) {
if (category.first.empty())