ENH: add flush params for multi filament

jira: STUDIO-11965

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I2245f22a03c65b570bc60a2792daf4c1683f1ebd
This commit is contained in:
xun.zhang 2025-04-27 21:26:07 +08:00 committed by lane.wei
parent 674fe4dab6
commit ffe2653341
6 changed files with 60 additions and 4 deletions

View File

@ -57,6 +57,12 @@
"filament_flow_ratio": [ "filament_flow_ratio": [
"1" "1"
], ],
"filament_flush_temp": [
"0"
],
"filament_flush_volumetric_speed": [
"0"
],
"filament_is_support": [ "filament_is_support": [
"0" "0"
], ],

View File

@ -765,6 +765,18 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
config.set_key_value("travel_point_3_x", new ConfigOptionFloat(float(travel_point_3.x()))); config.set_key_value("travel_point_3_x", new ConfigOptionFloat(float(travel_point_3.x())));
config.set_key_value("travel_point_3_y", new ConfigOptionFloat(float(travel_point_3.y()))); config.set_key_value("travel_point_3_y", new ConfigOptionFloat(float(travel_point_3.y())));
auto flush_v_speed = m_print_config->filament_flush_volumetric_speed.values;
auto flush_temps = m_print_config->filament_flush_temp.values;
for (size_t idx = 0; idx < flush_v_speed.size(); ++idx) {
if (flush_v_speed[idx] == 0)
flush_v_speed[idx] = m_print_config->filament_max_volumetric_speed.get_at(idx);
}
for (size_t idx = 0; idx < flush_temps.size(); ++idx) {
if (flush_temps[idx] == 0)
flush_temps[idx] = m_print_config->nozzle_temperature_range_high.get_at(idx);
}
config.set_key_value("flush_volumetric_speeds", new ConfigOptionFloats(flush_v_speed));
config.set_key_value("flush_temperatures", new ConfigOptionInts(flush_temps));
config.set_key_value("flush_length", new ConfigOptionFloat(purge_length)); config.set_key_value("flush_length", new ConfigOptionFloat(purge_length));
config.set_key_value("wipe_avoid_perimeter", new ConfigOptionBool(is_used_travel_avoid_perimeter)); config.set_key_value("wipe_avoid_perimeter", new ConfigOptionBool(is_used_travel_avoid_perimeter));
config.set_key_value("wipe_avoid_pos_x", new ConfigOptionFloat(wipe_avoid_pos_x)); config.set_key_value("wipe_avoid_pos_x", new ConfigOptionFloat(wipe_avoid_pos_x));
@ -2203,6 +2215,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_placeholder_parser.set("retraction_distances_when_cut", new ConfigOptionFloatsNullable(m_config.retraction_distances_when_cut)); m_placeholder_parser.set("retraction_distances_when_cut", new ConfigOptionFloatsNullable(m_config.retraction_distances_when_cut));
m_placeholder_parser.set("long_retractions_when_cut",new ConfigOptionBoolsNullable(m_config.long_retractions_when_cut)); m_placeholder_parser.set("long_retractions_when_cut",new ConfigOptionBoolsNullable(m_config.long_retractions_when_cut));
//Set variable for total layer count so it can be used in custom gcode. //Set variable for total layer count so it can be used in custom gcode.
m_placeholder_parser.set("total_layer_count", m_layer_count); m_placeholder_parser.set("total_layer_count", m_layer_count);
// Useful for sequential prints. // Useful for sequential prints.
@ -6217,6 +6230,18 @@ std::string GCode::set_extruder(unsigned int new_filament_id, double print_z, bo
dyn_config.set_key_value("wipe_avoid_perimeter", new ConfigOptionBool(false)); dyn_config.set_key_value("wipe_avoid_perimeter", new ConfigOptionBool(false));
dyn_config.set_key_value("wipe_avoid_pos_x", new ConfigOptionFloat(wipe_avoid_pos_x)); dyn_config.set_key_value("wipe_avoid_pos_x", new ConfigOptionFloat(wipe_avoid_pos_x));
auto flush_v_speed = m_print->config().filament_flush_volumetric_speed.values;
auto flush_temps =m_print->config().filament_flush_temp.values;
for (size_t idx = 0; idx < flush_v_speed.size(); ++idx) {
if (flush_v_speed[idx] == 0)
flush_v_speed[idx] = m_print->config().filament_max_volumetric_speed.get_at(idx);
}
for (size_t idx = 0; idx < flush_temps.size(); ++idx) {
if (flush_temps[idx] == 0)
flush_temps[idx] = m_print->config().nozzle_temperature_range_high.get_at(idx);
}
dyn_config.set_key_value("flush_volumetric_speeds", new ConfigOptionFloats(flush_v_speed));
dyn_config.set_key_value("flush_temperatures", new ConfigOptionInts(flush_temps));
dyn_config.set_key_value("flush_length", new ConfigOptionFloat(wipe_length)); dyn_config.set_key_value("flush_length", new ConfigOptionFloat(wipe_length));
int flush_count = std::min(g_max_flush_count, (int)std::round(wipe_volume / g_purge_volume_one_time)); int flush_count = std::min(g_max_flush_count, (int)std::round(wipe_volume / g_purge_volume_one_time));

View File

@ -937,7 +937,7 @@ static std::vector<std::string> s_Preset_filament_options {/*"filament_colour",
"enable_pressure_advance", "pressure_advance", "chamber_temperatures","filament_notes", "enable_pressure_advance", "pressure_advance", "chamber_temperatures","filament_notes",
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut","filament_shrink", "filament_long_retractions_when_cut","filament_retraction_distances_when_cut","filament_shrink",
//BBS filament change length while the extruder color //BBS filament change length while the extruder color
"filament_change_length","filament_prime_volume" "filament_change_length","filament_prime_volume","filament_flush_volumetric_speed","filament_flush_temp"
}; };
static std::vector<std::string> s_Preset_machine_limits_options { static std::vector<std::string> s_Preset_machine_limits_options {

View File

@ -1733,6 +1733,24 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<FilamentMapMode>(fmmAutoForFlush)); def->set_default_value(new ConfigOptionEnum<FilamentMapMode>(fmmAutoForFlush));
def = this->add("filament_flush_temp", coInts);
def->label = L("Flush temperature");
def->tooltip = L("temperature when flushing filament");
def->mode = comAdvanced;
def->nullable = true;
def->min = 0;
def->max = max_temp;
def->set_default_value(new ConfigOptionIntsNullable{0});
def = this->add("filament_flush_volumetric_speed", coFloats);
def->label = L("Flush volumetric speed");
def->tooltip = L("Volumetric speed when flushing filament");
def->mode = comAdvanced;
def->nullable = true;
def->min = 0;
def->max = 200;
def->set_default_value(new ConfigOptionFloatsNullable{ 0 });
def = this->add("filament_max_volumetric_speed", coFloats); def = this->add("filament_max_volumetric_speed", coFloats);
def->label = L("Max volumetric speed"); def->label = L("Max volumetric speed");
def->tooltip = L("This setting stands for how much volume of filament can be melted and extruded per second. " def->tooltip = L("This setting stands for how much volume of filament can be melted and extruded per second. "
@ -5707,8 +5725,9 @@ std::set<std::string> filament_options_with_variant = {
"filament_long_retractions_when_cut", "filament_long_retractions_when_cut",
"filament_retraction_distances_when_cut", "filament_retraction_distances_when_cut",
"nozzle_temperature_initial_layer", "nozzle_temperature_initial_layer",
"nozzle_temperature" "nozzle_temperature",
"filament_flush_volumetric_speed",
"filament_flush_temp"
}; };
// Parameters that are the same as the number of extruders // Parameters that are the same as the number of extruders

View File

@ -1062,6 +1062,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatsNullable, hotend_cooling_rate)) ((ConfigOptionFloatsNullable, hotend_cooling_rate))
((ConfigOptionFloatsNullable, hotend_heating_rate)) ((ConfigOptionFloatsNullable, hotend_heating_rate))
((ConfigOptionFloats, filament_minimal_purge_on_wipe_tower)) ((ConfigOptionFloats, filament_minimal_purge_on_wipe_tower))
((ConfigOptionFloatsNullable, filament_flush_volumetric_speed))
((ConfigOptionIntsNullable, filament_flush_temp))
// BBS // BBS
((ConfigOptionBool, scan_first_layer)) ((ConfigOptionBool, scan_first_layer))
((ConfigOptionPoints, thumbnail_size)) ((ConfigOptionPoints, thumbnail_size))

View File

@ -3508,6 +3508,11 @@ void TabFilament::build()
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup->m_on_change = [this, optgroup](const t_config_option_key &opt_key, const boost::any &value) { validate_custom_note_cb(this, optgroup, opt_key, value); }; optgroup->m_on_change = [this, optgroup](const t_config_option_key &opt_key, const boost::any &value) { validate_custom_note_cb(this, optgroup, opt_key, value); };
page = add_options_page(L("Multi Filament"), "advanced");
optgroup = page->new_optgroup(L("Multi Filament"));
optgroup->append_single_option_line("filament_flush_temp", "", 0);
optgroup->append_single_option_line("filament_flush_volumetric_speed", "", 0);
//BBS //BBS
#if 0 #if 0
//page = add_options_page(L("Dependencies"), "advanced"); //page = add_options_page(L("Dependencies"), "advanced");
@ -4274,7 +4279,6 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
// do not display this params now // do not display this params now
optgroup->append_single_option_line("long_retractions_when_cut", "", extruder_idx); optgroup->append_single_option_line("long_retractions_when_cut", "", extruder_idx);
optgroup->append_single_option_line("retraction_distances_when_cut", "", extruder_idx); optgroup->append_single_option_line("retraction_distances_when_cut", "", extruder_idx);
#if 0 #if 0
//optgroup = page->new_optgroup(L("Preview"), -1, true); //optgroup = page->new_optgroup(L("Preview"), -1, true);