From 8e9251f2f0044bdbe6e2985cbc6b30b0384410c7 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 22 Dec 2023 15:46:43 +0100 Subject: [PATCH] Wipe tower: separate acceleration control (related to #10854) --- src/libslic3r/GCode/WipeTowerIntegration.cpp | 4 ++++ src/libslic3r/Preset.cpp | 2 +- src/libslic3r/Print.cpp | 3 ++- src/libslic3r/PrintConfig.cpp | 9 +++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/slic3r/GUI/ConfigManipulation.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 1 + 7 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode/WipeTowerIntegration.cpp b/src/libslic3r/GCode/WipeTowerIntegration.cpp index 2f37ecbb06..4dd9a78112 100644 --- a/src/libslic3r/GCode/WipeTowerIntegration.cpp +++ b/src/libslic3r/GCode/WipeTowerIntegration.cpp @@ -106,7 +106,11 @@ std::string WipeTowerIntegration::append_tcr(GCodeGenerator &gcodegen, const Wip boost::replace_first(tcr_rotated_gcode, "[deretraction_from_wipe_tower_generator]", deretraction_str); std::string tcr_gcode; unescape_string_cstyle(tcr_rotated_gcode, tcr_gcode); + + if (gcodegen.config().default_acceleration > 0) + gcode += gcodegen.writer().set_print_acceleration(fast_round_up(gcodegen.config().wipe_tower_acceleration.value)); gcode += tcr_gcode; + gcode += gcodegen.writer().set_print_acceleration(fast_round_up(gcodegen.config().default_acceleration.value)); // A phony move to the end position at the wipe tower. gcodegen.writer().travel_to_xy(end_pos.cast()); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 4fd6d9d058..ae3bedb38e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -450,7 +450,7 @@ static std::vector s_Preset_print_options { "enable_dynamic_overhang_speeds", "overhang_speed_0", "overhang_speed_1", "overhang_speed_2", "overhang_speed_3", "top_solid_infill_speed", "support_material_speed", "support_material_xy_spacing", "support_material_interface_speed", "bridge_speed", "gap_fill_speed", "gap_fill_enabled", "travel_speed", "travel_speed_z", "first_layer_speed", "first_layer_speed_over_raft", "perimeter_acceleration", "infill_acceleration", - "external_perimeter_acceleration", "top_solid_infill_acceleration", "solid_infill_acceleration", "travel_acceleration", + "external_perimeter_acceleration", "top_solid_infill_acceleration", "solid_infill_acceleration", "travel_acceleration", "wipe_tower_acceleration", "bridge_acceleration", "first_layer_acceleration", "first_layer_acceleration_over_raft", "default_acceleration", "skirts", "skirt_distance", "skirt_height", "draft_shield", "min_skirt_length", "brim_width", "brim_separation", "brim_type", "support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers", "raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 615b91d6dc..6a5cb1d4f4 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -172,7 +172,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "use_relative_e_distances", "use_volumetric_e", "variable_layer_height", - "wipe" + "wipe", + "wipe_tower_acceleration" }; static std::unordered_set steps_ignore; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2859d2cf21..7f2e58d6bb 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1574,6 +1574,15 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("wipe_tower_acceleration", coFloat); + def->label = L("Wipe tower"); + def->tooltip = L("This is the acceleration your printer will use for wipe tower. Set zero to disable " + "acceleration control for the wipe tower."); + def->sidetext = L("mm/s²"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("travel_acceleration", coFloat); def->label = L("Travel"); def->tooltip = L("This is the acceleration your printer will use for travel moves. Set zero to disable " diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index fc209c9b6a..ee02a96535 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -870,6 +870,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloat, travel_acceleration)) ((ConfigOptionBools, wipe)) ((ConfigOptionBool, wipe_tower)) + ((ConfigOptionFloat, wipe_tower_acceleration)) ((ConfigOptionFloat, wipe_tower_x)) ((ConfigOptionFloat, wipe_tower_y)) ((ConfigOptionFloat, wipe_tower_width)) diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 3e8554885d..a711ad2da4 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -261,7 +261,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) bool have_default_acceleration = config->opt_float("default_acceleration") > 0; for (auto el : { "perimeter_acceleration", "infill_acceleration", "top_solid_infill_acceleration", "solid_infill_acceleration", "external_perimeter_acceleration", - "bridge_acceleration", "first_layer_acceleration" }) + "bridge_acceleration", "first_layer_acceleration", "wipe_tower_acceleration"}) toggle_field(el, have_default_acceleration); bool have_skirt = config->opt_int("skirts") > 0; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 7444f7d86a..464e982a96 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1621,6 +1621,7 @@ void TabPrint::build() optgroup->append_single_option_line("bridge_acceleration"); optgroup->append_single_option_line("first_layer_acceleration"); optgroup->append_single_option_line("first_layer_acceleration_over_raft"); + optgroup->append_single_option_line("wipe_tower_acceleration"); optgroup->append_single_option_line("travel_acceleration"); optgroup->append_single_option_line("default_acceleration");