Skip to content

Commit

Permalink
fix toolchange
Browse files Browse the repository at this point in the history
  • Loading branch information
studiodyne committed Dec 2, 2023
1 parent bd6eb83 commit e9181c4
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Marlin/src/module/tool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,12 +1075,26 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
destination.y = current_position.y;
#endif
do_blocking_move_to_xy(destination, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]);
planner.synchronize();
}
#endif

extruder_cutting_recover(destination.e); // Cutting recover
if (ok) do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]);
planner.synchronize();

// Clone previous position
planner.set_e_position_mm(current_position.e = destination.e);
extruder_cutting_recover(current_position.e); // Cutting recover

// Retract if previously retracted
#if ENABLED(FWRETRACT)
if (fwretract.retracted[active_extruder])
unscaled_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s);
#endif

// If resume_position is negative
if (current_position.e < 0) unscaled_e_move(current_position.e, MMM_TO_MMS(toolchange_settings.retract_speed));
planner.synchronize();
planner.set_e_position_mm(current_position.e); // Extruder primed and ready
}
}

Expand Down Expand Up @@ -1597,6 +1611,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
unscaled_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s);
#endif

// If resume_position is negative
if (resume_current_e < 0) unscaled_e_move(resume_current_e, MMM_TO_MMS(toolchange_settings.retract_speed));

// If no available extruder
if (EXTRUDERS < 2 || active_extruder >= EXTRUDERS - 2 || active_extruder == migration.last)
migration.automode = false;
Expand Down

0 comments on commit e9181c4

Please sign in to comment.