Wipe tower: set travel feedrate for a move from custom toolchange position to the wipe tower (#5483)

This commit is contained in:
Lukas Matena 2021-03-22 14:07:28 +01:00
parent 67bc2e472f
commit 3459231111
2 changed files with 17 additions and 5 deletions

View file

@ -111,8 +111,10 @@ public:
WipeTowerWriter& feedrate(float f)
{
if (f != m_current_feedrate)
if (f != m_current_feedrate) {
m_gcode += "G1" + set_format_F(f) + "\n";
m_current_feedrate = f;
}
return *this;
}
@ -523,9 +525,14 @@ WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<fl
m_bridging(float(config.wipe_tower_bridging)),
m_no_sparse_layers(config.wipe_tower_no_sparse_layers),
m_gcode_flavor(config.gcode_flavor),
m_travel_speed(config.travel_speed),
m_first_layer_speed(config.get_abs_value("first_layer_speed")),
m_current_tool(initial_tool),
wipe_volumes(wiping_matrix)
{
if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it.
m_first_layer_speed = 2400.f;
// 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.
if (m_semm) {
@ -677,7 +684,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
if (m_set_extruder_trimpot)
writer.set_extruder_trimpot(550);
writer.speed_override_restore()
.feedrate(6000)
.feedrate(m_travel_speed * 60.f)
.flush_planner_queue()
.reset_extruder()
.append("; CP PRIMING END\n"
@ -762,7 +769,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool)
if (m_set_extruder_trimpot)
writer.set_extruder_trimpot(550); // Reset the extruder current to a normal value.
writer.speed_override_restore();
writer.feedrate(6000)
writer.feedrate(m_travel_speed * 60.f)
.flush_planner_queue()
.reset_extruder()
.append("; CP TOOLCHANGE END\n"
@ -933,7 +940,10 @@ void WipeTower::toolchange_Change(
// gcode could have left the extruder somewhere, we cannot just start extruding. We should also inform the
// postprocessor that we absolutely want to have this in the gcode, even if it thought it is the same as before.
Vec2f current_pos = writer.pos_rotated();
writer.append(std::string("G1 X") + std::to_string(current_pos.x()) + " Y" + std::to_string(current_pos.y()) + never_skip_tag() + "\n");
writer.feedrate(m_travel_speed * 60.f) // see https://github.com/prusa3d/PrusaSlicer/issues/5483
.append(std::string("G1 X") + std::to_string(current_pos.x())
+ " Y" + std::to_string(current_pos.y())
+ never_skip_tag() + "\n");
// The toolchange Tn command will be inserted later, only in case that the user does
// not provide a custom toolchange gcode.

View file

@ -259,6 +259,8 @@ private:
float m_layer_height = 0.f; // Current layer height.
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;
// G-code generator parameters.
float m_cooling_tube_retraction = 0.f;
@ -383,6 +385,6 @@ private:
}; // namespace Slic3r
} // namespace Slic3r
#endif // WipeTowerPrusaMM_hpp_