Implemented M220 B / M220 R for backup / restore of the speed override
at the firmware. The M220 B / M220 R are only applied for MM prints without any flex or soluble (PVA, BVOH) material, as for these materials the MMU slows down the print using the M220 code. fixes "LCD Speed Modifier Lost on Tool Change #421"
This commit is contained in:
parent
45e611c9fc
commit
d0edc36400
2 changed files with 38 additions and 9 deletions
|
@ -315,6 +315,20 @@ public:
|
|||
return *this;
|
||||
};
|
||||
|
||||
// Let the firmware back up the active speed override value.
|
||||
Writer& speed_override_backup()
|
||||
{
|
||||
m_gcode += "M220 B\n";
|
||||
return *this;
|
||||
};
|
||||
|
||||
// Let the firmware restore the active speed override value.
|
||||
Writer& speed_override_restore()
|
||||
{
|
||||
m_gcode += "M220 R\n";
|
||||
return *this;
|
||||
};
|
||||
|
||||
// Set digital trimpot motor
|
||||
Writer& set_extruder_trimpot(int current)
|
||||
{
|
||||
|
@ -501,8 +515,10 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
|
|||
.set_initial_tool(m_current_tool)
|
||||
.append(";--------------------\n"
|
||||
"; CP PRIMING START\n")
|
||||
.append(";--------------------\n")
|
||||
.speed_override(100);
|
||||
.append(";--------------------\n");
|
||||
if (m_retain_speed_override)
|
||||
writer.speed_override_backup();
|
||||
writer.speed_override(100);
|
||||
|
||||
writer.set_initial_position(xy(0.f, 0.f)) // Always move to the starting position
|
||||
.travel(cleaning_box.ld, 7200);
|
||||
|
@ -536,6 +552,8 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
|
|||
// Reset the extruder current to a normal value.
|
||||
if (m_set_extruder_trimpot)
|
||||
writer.set_extruder_trimpot(550);
|
||||
if (m_retain_speed_override)
|
||||
writer.speed_override_restore();
|
||||
writer.feedrate(6000)
|
||||
.flush_planner_queue()
|
||||
.reset_extruder()
|
||||
|
@ -602,8 +620,10 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
|||
"; CP TOOLCHANGE START\n")
|
||||
.comment_with_value(" toolchange #", m_num_tool_changes + 1) // the number is zero-based
|
||||
.comment_material(m_filpar[m_current_tool].material)
|
||||
.append(";--------------------\n")
|
||||
.speed_override(100);
|
||||
.append(";--------------------\n");
|
||||
if (m_retain_speed_override)
|
||||
writer.speed_override_backup();
|
||||
writer.speed_override(100);
|
||||
|
||||
xy initial_position = cleaning_box.ld + WipeTower::xy(0.f,m_depth_traversed);
|
||||
writer.set_initial_position(initial_position, m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
|
||||
|
@ -640,6 +660,8 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
|
|||
|
||||
if (m_set_extruder_trimpot)
|
||||
writer.set_extruder_trimpot(550); // Reset the extruder current to a normal value.
|
||||
if (m_retain_speed_override)
|
||||
writer.speed_override_restore();
|
||||
writer.feedrate(6000)
|
||||
.flush_planner_queue()
|
||||
.reset_extruder()
|
||||
|
@ -885,14 +907,15 @@ void WipeTowerPrusaMM::toolchange_Change(
|
|||
case FLEX: speed_override = 35; break;
|
||||
default: speed_override = 100;
|
||||
}
|
||||
writer.set_tool(new_tool)
|
||||
.speed_override(speed_override)
|
||||
.flush_planner_queue();
|
||||
writer.set_tool(new_tool);
|
||||
if (m_retain_speed_override)
|
||||
assert(speed_override == 100);
|
||||
else
|
||||
writer.speed_override(speed_override);
|
||||
writer.flush_planner_queue();
|
||||
m_current_tool = new_tool;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WipeTowerPrusaMM::toolchange_Load(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
const box_coordinates &cleaning_box)
|
||||
|
|
|
@ -75,6 +75,11 @@ public:
|
|||
m_filpar.push_back(FilamentParameters());
|
||||
|
||||
m_filpar[idx].material = material;
|
||||
if (material == FLEX || material == SCAFF || material == PVA) {
|
||||
// MMU2 lowers the print speed using the speed override (M220) for printing of soluble PVA/BVOH and flex materials.
|
||||
// Therefore it does not make sense to use the new M220 B and M220 R (backup / restore).
|
||||
m_retain_speed_override = false;
|
||||
}
|
||||
m_filpar[idx].temperature = temp;
|
||||
m_filpar[idx].first_layer_temperature = first_layer_temp;
|
||||
m_filpar[idx].loading_speed = loading_speed;
|
||||
|
@ -215,6 +220,7 @@ private:
|
|||
float m_extra_loading_move = 0.f;
|
||||
float m_bridging = 0.f;
|
||||
bool m_set_extruder_trimpot = false;
|
||||
bool m_retain_speed_override = true;
|
||||
bool m_adhesion = true;
|
||||
|
||||
float m_perimeter_width = 0.4 * Width_To_Nozzle_Ratio; // Width of an extrusion line, also a perimeter spacing for 100% infill.
|
||||
|
|
Loading…
Reference in a new issue