ENH: enhance auto flush option

1.Support auto flush when change printer and nozzle volume type

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I9dfc2fff095bbf1901afe99556d1e57aa225f482
(cherry picked from commit f12305832227940eb0eae05817ad046dd4eff02d)
This commit is contained in:
xun.zhang
2025-02-17 21:21:10 +08:00
committed by Noisyfox
parent 27b16455b7
commit 0af34f4324
6 changed files with 158 additions and 130 deletions

View File

@@ -1725,19 +1725,6 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
}
}
// -1 means caculate all
auto update_flush_volume = [](int idx = -1) {
if (idx < 0) {
size_t filament_size = wxGetApp().plater()->get_extruder_colors_from_plater_config().size();
for (size_t i = 0; i < filament_size; ++i)
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(i);
}
else
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(idx);
};
string opt_key_without_idx = opt_key.substr(0, opt_key.find('#'));
if (opt_key_without_idx == "long_retractions_when_cut") {
@@ -1748,6 +1735,9 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
"Although it can notably reduce flush, it may also elevate the risk of nozzle clogs or other printing complications."), "", wxICON_WARNING | wxOK);
dialog.ShowModal();
}
if (wxGetApp().app_config->get("auto_calculate_flush") == "all"){
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1);
}
}
if (opt_key == "filament_long_retractions_when_cut"){
@@ -1759,6 +1749,9 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
"Please use with the latest printer firmware."), "", wxICON_WARNING | wxOK);
dialog.ShowModal();
}
if (wxGetApp().app_config->get("auto_calculate_flush") == "all"){
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1);
}
}
@@ -1799,6 +1792,9 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
tab->update_extruder_variants(extruder_idx);
tab->reload_config();
}
if (wxGetApp().app_config->get("auto_calculate_flush") == "all") {
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(-1,extruder_idx);
}
}
if (m_preset_bundle->get_printer_extruder_count() > 1){