|
|
@ -487,6 +487,133 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { |
|
|
|
|
|
|
|
#endif // SWITCHING_TOOLHEAD
|
|
|
|
|
|
|
|
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) |
|
|
|
|
|
|
|
inline void magnetic_switching_toolhead_tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { |
|
|
|
if (no_move) return; |
|
|
|
|
|
|
|
const float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS, |
|
|
|
placexpos = toolheadposx[active_extruder], |
|
|
|
grabxpos = toolheadposx[tmp_extruder]; |
|
|
|
|
|
|
|
/**
|
|
|
|
* 1. Raise Z to give enough clearance |
|
|
|
* 2. Move to switch position of current toolhead |
|
|
|
* 3. Release and place toolhead in the dock |
|
|
|
* 4. Move to the new toolhead |
|
|
|
* 5. Grab the new toolhead and move to security position |
|
|
|
*/ |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); |
|
|
|
|
|
|
|
// 1. Raise Z to give enough clearance
|
|
|
|
|
|
|
|
current_position[Z_AXIS] += toolchange_settings.z_raise; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
// 2. Move to switch position current toolhead
|
|
|
|
|
|
|
|
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) { |
|
|
|
SERIAL_ECHOLNPAIR("(2) Place old tool ", int(active_extruder)); |
|
|
|
DEBUG_POS("Move Y SwitchPos + Security", current_position); |
|
|
|
} |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
current_position[X_AXIS] = placexpos + SWITCHING_TOOLHEAD_X_SECURITY; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos + Security", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
current_position[X_AXIS] = placexpos; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
// 3. Release and place toolhead in the dock
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Release and Place Toolhead"); |
|
|
|
|
|
|
|
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.1), active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_SECURITY; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
// 4. Move to new toolhead position
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position"); |
|
|
|
|
|
|
|
current_position[X_AXIS] = grabxpos; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
// 5. Grab the new toolhead and move to security position
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab new toolhead and move to security position"); |
|
|
|
|
|
|
|
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
|
|
|
|
current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.2, active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
safe_delay(100); |
|
|
|
|
|
|
|
current_position[X_AXIS] = grabxpos + SWITCHING_TOOLHEAD_X_SECURITY; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X + Security", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.1, active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
safe_delay(100); |
|
|
|
|
|
|
|
current_position[Y_AXIS] += SWITCHING_TOOLHEAD_Y_CLEAR; |
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); |
|
|
|
|
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead
|
|
|
|
planner.synchronize(); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // MAGNETIC_SWITCHING_TOOLHEAD
|
|
|
|
|
|
|
|
inline void invalid_extruder_error(const uint8_t e) { |
|
|
|
SERIAL_ECHO_START(); |
|
|
|
SERIAL_CHAR('T'); SERIAL_ECHO(int(e)); |
|
|
@ -557,6 +684,11 @@ inline void invalid_extruder_error(const uint8_t e) { |
|
|
|
* previous tool out of the way and the new tool into place. |
|
|
|
*/ |
|
|
|
void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { |
|
|
|
|
|
|
|
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) |
|
|
|
if (tmp_extruder == active_extruder) return; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(MIXING_EXTRUDER) |
|
|
|
|
|
|
|
UNUSED(fr_mm_s); UNUSED(no_move); |
|
|
@ -686,6 +818,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n |
|
|
|
magnetic_parking_extruder_tool_change(tmp_extruder); |
|
|
|
#elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead
|
|
|
|
switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); |
|
|
|
#elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead
|
|
|
|
magnetic_switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); |
|
|
|
#elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS |
|
|
|
// Raise by a configured distance to avoid workpiece, except with
|
|
|
|
// SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead.
|
|
|
@ -755,7 +889,16 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n |
|
|
|
#endif |
|
|
|
|
|
|
|
// Prevent a move outside physical bounds
|
|
|
|
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) |
|
|
|
// If the original position is within tool store area, go to X origin at once
|
|
|
|
if (destination[Y_AXIS] < SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR) { |
|
|
|
current_position[X_AXIS] = 0; |
|
|
|
planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); |
|
|
|
planner.synchronize(); |
|
|
|
} |
|
|
|
#else |
|
|
|
apply_motion_limits(destination); |
|
|
|
#endif |
|
|
|
|
|
|
|
// Move back to the original (or tweaked) position
|
|
|
|
do_blocking_move_to(destination); |
|
|
|