Skip to content

Commit

Permalink
# Add a speed knob to the wipe tower.
Browse files Browse the repository at this point in the history
The default for wipe_tower_speed is 80mm/s which was hardcoded before.
The perimeter and grid section of the wipe tower will also print at
wipe_tower_speed. Though before it was hardcoded independently at
60mm/s.

wipe_tower_wipe_starting_speed is set to 26mm/s by default. And uses the
same ramp up logic as before. Ramping up the speed of the wipe lines
with an aggressive curve, before moving linearly 0.8mm/s at a time.

wipe_tower_wipe_starting_speed can be turned of by setting to 0.

The wipe_tower_speed is capped by the filament_max_volumetric_speed.
If filament_max_volumetric_speed is not set (0 value), then there is no
cap.

I personally only set a filament_max_volumetric_speed on stuff like very
flexible TPU and what not. For the rest, I depend on the global
volumetric speed limit. This way, I can set the wipe tower speed to
exceed my normal printing flow rate since quality of the wipe tower
doesn't matter. But a low flow rate filament would still be capped by
filament_max_volumetric_speed, preventing a mess.

Using bombela@3fbe811

supermerill:
* add % for wipe_tower_wipe_starting_speed

#3569
  • Loading branch information
GurgenCD authored and supermerill committed Apr 25, 2023
1 parent 6207cb6 commit 4150174
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 17 deletions.
2 changes: 2 additions & 0 deletions resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ group:label_width$8:sidetext_width$7:Speed for print moves
line:Other speed
setting:width$4:thin_walls_speed
setting:width$4:ironing_speed
setting:wipe_tower_speed
setting:wipe_tower_wipe_starting_speed
group:Speed for non-print moves
line:Travel speed
setting:label$xy:travel_speed
Expand Down
33 changes: 22 additions & 11 deletions src/libslic3r/GCode/WipeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class WipeTowerWriter
}

WipeTowerWriter& extrude_explicit(const Vec2f &dest, float e, float f = 0.f, bool record_length = false, bool limit_volumetric_flow = true)
{ return extrude_explicit(dest.x(), dest.y(), e, f, record_length); }
{ return extrude_explicit(dest.x(), dest.y(), e, f, record_length, limit_volumetric_flow); }

// Travel to a new XY position. f=0 means use the current value.
WipeTowerWriter& travel(float x, float y, float f = 0.f)
Expand Down Expand Up @@ -634,6 +634,7 @@ WipeTower::WipeTower(const PrintConfig& config, const PrintObjectConfig& default
m_wipe_tower_pos(config.wipe_tower_x, config.wipe_tower_y),
m_wipe_tower_width(float(config.wipe_tower_width)),
m_wipe_tower_rotation_angle(float(config.wipe_tower_rotation_angle)),
m_speed(float(config.wipe_tower_speed)),
m_y_shift(0.f),
m_z_pos(0.f),
m_bridging(float(config.wipe_tower_bridging)),
Expand All @@ -643,13 +644,16 @@ WipeTower::WipeTower(const PrintConfig& config, const PrintObjectConfig& default
m_current_tool(initial_tool),
wipe_volumes(wiping_matrix)
{
// be sure the speed is positive
if (m_speed <= 0) {
m_speed = 80;
}
// Read absolute value of first layer speed, if given as percentage,
// it is taken over following default. Speeds from config are not
// easily accessible here.
const float default_speed = 60.f;
m_first_layer_speed = config.get_abs_value("first_layer_speed", default_speed);
if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it.
m_first_layer_speed = default_speed / 2.f;
// it is taken over wipe_tower_speed.
m_first_layer_speed = config.get_abs_value("first_layer_speed", m_speed);
if (m_first_layer_speed == 0.f) { // just to make sure autospeed doesn't break it.
m_first_layer_speed = m_speed;
}

// If this is a single extruder MM printer, we will use all the SE-specific config values.
// Otherwise, the defaults will be used to turn off the SE stuff.
Expand Down Expand Up @@ -1241,6 +1245,7 @@ void WipeTower::toolchange_Wipe(

// Speed override for the material. Go slow for flex and soluble materials.
speed_factor *= get_speed_reduction();
speed_factor *= 60.f; // mm/s -> mm/min

// Variables x_to_wipe and traversed_x are here to be able to make sure it always wipes at least
// the ordered volume, even if it means violating the box. This can later be removed and simply
Expand All @@ -1249,10 +1254,16 @@ void WipeTower::toolchange_Wipe(
float x_to_wipe = volume_to_length(wipe_volume, m_perimeter_width, m_layer_height);
float dy = m_extra_spacing*m_perimeter_width;

const float target_speed = is_first_layer() ? m_first_layer_speed * 60.f : 4800.f;
float wipe_speed = 0.33f * target_speed;
// all speed in mm/s, will converted in mm/min when muliplied by speed_factor
float max_speed = std::numeric_limits<float>::max();
//stay in limits
if (this->m_config->filament_max_speed.get_at(this->m_current_tool) > 0) {
wipe_speed = std::min(wipe_speed, float(this->m_config->filament_max_speed.get_at(this->m_current_tool)) * 60.f); // mm/s -> mm/min
max_speed = float(this->m_config->filament_max_speed.get_at(this->m_current_tool));
}
const float target_speed = std::min(max_speed, (is_first_layer() ? m_first_layer_speed : m_speed) * 60.f);
float wipe_speed = std::min(max_speed, std::min(target_speed, float(m_config->wipe_tower_wipe_starting_speed.get_abs_value(target_speed))));
if (wipe_speed <= 0) {
wipe_speed = target_speed;
}

// if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway)
Expand Down Expand Up @@ -1322,7 +1333,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
// Slow down on the 1st layer.
bool first_layer = is_first_layer();
float speed_factor = 1.f;
float feedrate = first_layer ? m_first_layer_speed * 60.f : 2900.f;
float feedrate = first_layer ? m_first_layer_speed * 60.f : m_speed * 60.f;
speed_factor *= get_speed_reduction();
float current_depth = m_layer_info->depth - m_layer_info->toolchanges_depth();
box_coordinates fill_box(Vec2f(m_perimeter_width, m_layer_info->depth-(current_depth-m_perimeter_width)),
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/GCode/WipeTower.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ class WipeTower
size_t m_max_color_changes = 0; // Maximum number of color changes per layer.
int m_old_temperature = -1; // To keep track of what was the last temp that we set (so we don't issue the command when not neccessary)
float m_travel_speed = 0.f;
float m_first_layer_speed = 0.f;
float m_first_layer_speed = 0.f; // First layer speed in mm/s.
size_t m_first_layer_idx = size_t(-1);
float m_speed = 0.f; // Wipe tower speed in mm/s.

// G-code generator parameters.
float m_cooling_tube_retraction = 0.f;
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ static std::vector<std::string> s_Preset_print_options {
"threads",
// wipe tower
"wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging",
"wipe_tower_speed", "wipe_tower_wipe_starting_speed",
"wipe_tower_brim_width",
"mmu_segmented_region_max_width",
"single_extruder_multi_material_priming",
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver& /* ne
|| opt_key == "wipe_tower_brim_width"
|| opt_key == "wipe_tower_bridging"
|| opt_key == "wipe_tower_no_sparse_layers"
|| opt_key == "wipe_tower_speed"
|| opt_key == "wipe_tower_wipe_starting_speed"
|| opt_key == "wiping_volumes_matrix"
|| opt_key == "parking_pos_retraction"
|| opt_key == "cooling_tube_retraction"
Expand Down
21 changes: 20 additions & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5545,7 +5545,6 @@ void PrintConfigDef::init_fff_params()
def->min = 0;
def->mode = comExpert | comSuSi;
def->set_default_value(new ConfigOptionFloatOrPercent(100, true));

def = this->add("threads", coInt);
def->label = L("Threads");
def->tooltip = L("Threads are used to parallelize long-running tasks. Optimal threads number "
Expand Down Expand Up @@ -5862,6 +5861,26 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvancedE | comPrusa;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("wipe_tower_speed", coFloat);
def->label = L("Wipe Tower Speed");
def->category = OptionCategory::speed;
def->tooltip = L("Printing speed of the wipe tower. Capped by filament_max_volumetric_speed (if set)."
"\nIf set to zero, a value of 80mm/s is used.");
def->sidetext = L("mm/s");
def->mode = comAdvancedE | comSuSi;
def->set_default_value(new ConfigOptionFloat(80.));

def = this->add("wipe_tower_wipe_starting_speed", coFloatOrPercent);
def->label = L("Wipe tower starting speed");
def->category = OptionCategory::speed;
def->tooltip = L("Start of the wiping speed ramp up (for wipe tower)."
"\nCan be a % of the 'Wipe tower speed'."
"\nSet to 0 to disable.");
def->sidetext = L("mm/s or %");
def->mode = comAdvancedE | comSuSi;
def->set_default_value(new ConfigOptionFloatOrPercent(33, true));


def = this->add("wiping_volumes_extruders", coFloats);
def->label = L("Purging volumes - load/unload volumes");
def->tooltip = L("This vector saves required volumes to change from/to each tool used on the "
Expand Down
8 changes: 5 additions & 3 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloats, deretract_speed))
((ConfigOptionString, end_gcode))
((ConfigOptionStrings, end_filament_gcode))
((ConfigOptionFloat, extra_loading_move))
((ConfigOptionPercents, extruder_fan_offset))
((ConfigOptionFloats, extruder_temperature_offset))
((ConfigOptionString, extrusion_axis))
Expand Down Expand Up @@ -1068,7 +1069,6 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, start_gcode_manual))
((ConfigOptionBool, single_extruder_multi_material))
((ConfigOptionBool, single_extruder_multi_material_priming))
((ConfigOptionBool, wipe_tower_no_sparse_layers))
((ConfigOptionStrings, tool_name))
((ConfigOptionString, toolchange_gcode))
((ConfigOptionFloat, travel_speed))
Expand All @@ -1084,17 +1084,19 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, remaining_times))
((ConfigOptionEnum<RemainingTimeType>, remaining_times_type))
((ConfigOptionBool, silent_mode))
((ConfigOptionFloat, extra_loading_move))
((ConfigOptionBool, wipe_advanced))
((ConfigOptionEnum<WipeAlgo>, wipe_advanced_algo))
((ConfigOptionFloat, wipe_advanced_nozzle_melted_volume))
((ConfigOptionFloat, wipe_advanced_multiplier))
((ConfigOptionPercents, wipe_inside_depth))
((ConfigOptionBools, wipe_inside_end))
((ConfigOptionBools, wipe_inside_start))
((ConfigOptionFloats, wipe_extra_perimeter))
((ConfigOptionEnum<WipeAlgo>, wipe_advanced_algo))
((ConfigOptionBools, wipe_only_crossing))
((ConfigOptionFloats, wipe_speed))
((ConfigOptionBool, wipe_tower_no_sparse_layers))
((ConfigOptionFloat, wipe_tower_speed))
((ConfigOptionFloatOrPercent, wipe_tower_wipe_starting_speed))
((ConfigOptionFloat, z_step))
((ConfigOptionString, color_change_gcode))
((ConfigOptionString, pause_print_gcode))
Expand Down
3 changes: 2 additions & 1 deletion src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)

bool have_wipe_tower = config->opt_bool("wipe_tower");
for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_brim_width",
"wipe_tower_bridging", "wipe_tower_brim", "wipe_tower_no_sparse_layers", "single_extruder_multi_material_priming" })
"wipe_tower_bridging", "wipe_tower_brim", "wipe_tower_no_sparse_layers", "single_extruder_multi_material_priming",
"wipe_tower_speed", "wipe_tower_wipe_starting_speed" })
toggle_field(el, have_wipe_tower);

bool have_avoid_crossing_perimeters = config->opt_bool("avoid_crossing_perimeters");
Expand Down

0 comments on commit 4150174

Please sign in to comment.