|
|
|
@ -146,10 +146,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
parkingtraveldistance, // M951 D
|
|
|
|
|
compensationmultiplier;
|
|
|
|
|
|
|
|
|
|
inline void magnetic_parking_extruder_tool_change(const uint8_t tmp_extruder) {
|
|
|
|
|
inline void magnetic_parking_extruder_tool_change(const uint8_t new_tool) {
|
|
|
|
|
|
|
|
|
|
const float oldx = current_position[X_AXIS],
|
|
|
|
|
grabpos = mpe_settings.parking_xpos[tmp_extruder] + (tmp_extruder ? mpe_settings.grab_distance : -mpe_settings.grab_distance),
|
|
|
|
|
grabpos = mpe_settings.parking_xpos[new_tool] + (new_tool ? mpe_settings.grab_distance : -mpe_settings.grab_distance),
|
|
|
|
|
offsetcompensation =
|
|
|
|
|
#if HAS_HOTEND_OFFSET
|
|
|
|
|
hotend_offset[X_AXIS][active_extruder] * mpe_settings.compensation_factor
|
|
|
|
@ -174,14 +174,14 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
|
|
|
|
|
// STEP 1
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = mpe_settings.parking_xpos[tmp_extruder] + offsetcompensation;
|
|
|
|
|
current_position[X_AXIS] = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPAIR("(1) Move extruder ", int(tmp_extruder));
|
|
|
|
|
DEBUG_ECHOPAIR("(1) Move extruder ", int(new_tool));
|
|
|
|
|
DEBUG_POS(" to new extruder ParkPos", current_position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.fast_feedrate, tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
// STEP 2
|
|
|
|
@ -189,11 +189,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
current_position[X_AXIS] = grabpos + offsetcompensation;
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPAIR("(2) Couple extruder ", int(tmp_extruder));
|
|
|
|
|
DEBUG_ECHOPAIR("(2) Couple extruder ", int(new_tool));
|
|
|
|
|
DEBUG_POS(" to new extruder GrabPos", current_position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.slow_feedrate, tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
// Delay before moving tool, to allow magnetic coupling
|
|
|
|
@ -201,24 +201,24 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
|
|
|
|
|
// STEP 3
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = mpe_settings.parking_xpos[tmp_extruder] + offsetcompensation;
|
|
|
|
|
current_position[X_AXIS] = mpe_settings.parking_xpos[new_tool] + offsetcompensation;
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPAIR("(3) Move extruder ", int(tmp_extruder));
|
|
|
|
|
DEBUG_ECHOPAIR("(3) Move extruder ", int(new_tool));
|
|
|
|
|
DEBUG_POS(" back to new extruder ParkPos", current_position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.slow_feedrate, tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
// STEP 4
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = mpe_settings.parking_xpos[active_extruder] + (active_extruder == 0 ? MPE_TRAVEL_DISTANCE : -MPE_TRAVEL_DISTANCE) + offsetcompensation;
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPAIR("(4) Move extruder ", int(tmp_extruder));
|
|
|
|
|
DEBUG_ECHOPAIR("(4) Move extruder ", int(new_tool));
|
|
|
|
|
DEBUG_POS(" close to old extruder ParkPos", current_position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.fast_feedrate, tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
// STEP 5
|
|
|
|
@ -226,11 +226,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
current_position[X_AXIS] = mpe_settings.parking_xpos[active_extruder] + offsetcompensation;
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPAIR("(5) Park extruder ", int(tmp_extruder));
|
|
|
|
|
DEBUG_ECHOPAIR("(5) Park extruder ", int(new_tool));
|
|
|
|
|
DEBUG_POS(" at old extruder ParkPos", current_position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.slow_feedrate, tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.slow_feedrate, new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
// STEP 6
|
|
|
|
@ -238,11 +238,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
current_position[X_AXIS] = oldx;
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPAIR("(6) Move extruder ", int(tmp_extruder));
|
|
|
|
|
DEBUG_ECHOPAIR("(6) Move extruder ", int(new_tool));
|
|
|
|
|
DEBUG_POS(" to starting position", current_position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.fast_feedrate, tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, mpe_settings.fast_feedrate, new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Autopark done.");
|
|
|
|
@ -269,7 +269,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void parking_extruder_tool_change(const uint8_t tmp_extruder, bool no_move) {
|
|
|
|
|
inline void parking_extruder_tool_change(const uint8_t new_tool, bool no_move) {
|
|
|
|
|
if (!no_move) {
|
|
|
|
|
|
|
|
|
|
constexpr float parkingposx[] = PARKING_EXTRUDER_PARKING_X;
|
|
|
|
@ -281,7 +281,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
const float midpos = (parkingposx[0] + parkingposx[1]) * 0.5 + x_offset,
|
|
|
|
|
grabpos = parkingposx[tmp_extruder] + (tmp_extruder ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset;
|
|
|
|
|
grabpos = parkingposx[new_tool] + (new_tool ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 1. Move to park position of old extruder
|
|
|
|
@ -325,11 +325,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
|
|
|
|
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
|
|
|
|
|
#endif
|
|
|
|
|
pe_activate_solenoid(tmp_extruder);
|
|
|
|
|
pe_activate_solenoid(new_tool);
|
|
|
|
|
|
|
|
|
|
// STEP 5
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = grabpos + (tmp_extruder ? -10 : 10);
|
|
|
|
|
current_position[X_AXIS] = grabpos + (new_tool ? -10 : 10);
|
|
|
|
|
fast_line_to_current(X_AXIS);
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = grabpos;
|
|
|
|
@ -343,7 +343,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = midpos
|
|
|
|
|
#if HAS_HOTEND_OFFSET
|
|
|
|
|
- hotend_offset[X_AXIS][tmp_extruder]
|
|
|
|
|
- hotend_offset[X_AXIS][new_tool]
|
|
|
|
|
#endif
|
|
|
|
|
;
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
@ -357,7 +357,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
}
|
|
|
|
|
else { // nomove == true
|
|
|
|
|
// Only engage magnetic field for new extruder
|
|
|
|
|
pe_activate_solenoid(tmp_extruder);
|
|
|
|
|
pe_activate_solenoid(new_tool);
|
|
|
|
|
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
|
|
|
|
pe_activate_solenoid(active_extruder); // Just save power for inverted magnets
|
|
|
|
|
#endif
|
|
|
|
@ -368,14 +368,14 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_TOOLHEAD)
|
|
|
|
|
|
|
|
|
|
inline void switching_toolhead_tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
inline void switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|
|
|
|
if (no_move) return;
|
|
|
|
|
|
|
|
|
|
constexpr uint16_t angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES;
|
|
|
|
|
|
|
|
|
|
constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS;
|
|
|
|
|
const float placexpos = toolheadposx[active_extruder],
|
|
|
|
|
grabxpos = toolheadposx[tmp_extruder];
|
|
|
|
|
grabxpos = toolheadposx[new_tool];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 1. Move to switch position of current toolhead
|
|
|
|
@ -464,7 +464,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
|
|
|
|
|
|
|
|
|
|
inline void magnetic_switching_toolhead_tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
inline void magnetic_switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|
|
|
|
if (no_move) return;
|
|
|
|
|
|
|
|
|
|
constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS,
|
|
|
|
@ -472,8 +472,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
|
|
|
|
|
const float placexpos = toolheadposx[active_extruder],
|
|
|
|
|
placexclear = toolheadclearx[active_extruder],
|
|
|
|
|
grabxpos = toolheadposx[tmp_extruder],
|
|
|
|
|
grabxclear = toolheadclearx[tmp_extruder];
|
|
|
|
|
grabxpos = toolheadposx[new_tool],
|
|
|
|
|
grabxclear = toolheadclearx[new_tool];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 1. Move to switch position of current toolhead
|
|
|
|
@ -564,11 +564,11 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
#if ENABLED(PRIME_BEFORE_REMOVE) && (SWITCHING_TOOLHEAD_PRIME_MM || SWITCHING_TOOLHEAD_RETRACT_MM)
|
|
|
|
|
#if SWITCHING_TOOLHEAD_PRIME_MM
|
|
|
|
|
current_position[E_AXIS] += SWITCHING_TOOLHEAD_PRIME_MM;
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(SWITCHING_TOOLHEAD_PRIME_FEEDRATE), tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(SWITCHING_TOOLHEAD_PRIME_FEEDRATE), new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
#if SWITCHING_TOOLHEAD_RETRACT_MM
|
|
|
|
|
current_position[E_AXIS] -= SWITCHING_TOOLHEAD_RETRACT_MM;
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(SWITCHING_TOOLHEAD_RETRACT_FEEDRATE), tmp_extruder);
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(SWITCHING_TOOLHEAD_RETRACT_FEEDRATE), new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
#else
|
|
|
|
|
planner.synchronize();
|
|
|
|
@ -595,12 +595,12 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
inline void est_deactivate_solenoid() { OUT_WRITE(SOL0_PIN, LOW); }
|
|
|
|
|
void est_init() { est_activate_solenoid(); }
|
|
|
|
|
|
|
|
|
|
inline void em_switching_toolhead_tool_change(const uint8_t tmp_extruder, bool no_move) {
|
|
|
|
|
inline void em_switching_toolhead_tool_change(const uint8_t new_tool, bool no_move) {
|
|
|
|
|
if (no_move) return;
|
|
|
|
|
|
|
|
|
|
constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS;
|
|
|
|
|
const float placexpos = toolheadposx[active_extruder],
|
|
|
|
|
grabxpos = toolheadposx[tmp_extruder];
|
|
|
|
|
grabxpos = toolheadposx[new_tool];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 1. Raise Z-Axis to give enough clearance
|
|
|
|
@ -688,7 +688,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) {
|
|
|
|
|
// 9. Apply Z hotend offset to current position
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("(9) Applying Z-offset", current_position);
|
|
|
|
|
current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
|
|
|
|
|
current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][new_tool];
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("EMST Tool-Change done.", current_position);
|
|
|
|
|
}
|
|
|
|
@ -703,7 +703,7 @@ inline void invalid_extruder_error(const uint8_t e) {
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
|
|
|
|
|
|
inline void dualx_tool_change(const uint8_t tmp_extruder, bool &no_move) {
|
|
|
|
|
inline void dualx_tool_change(const uint8_t new_tool, bool &no_move) {
|
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
|
DEBUG_ECHOPGM("Dual X Carriage Mode ");
|
|
|
|
|
switch (dual_x_carriage_mode) {
|
|
|
|
@ -728,7 +728,7 @@ inline void invalid_extruder_error(const uint8_t e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Activate the new extruder ahead of calling set_axis_is_at_home!
|
|
|
|
|
active_extruder = tmp_extruder;
|
|
|
|
|
active_extruder = new_tool;
|
|
|
|
|
|
|
|
|
|
// This function resets the max/min values - the current position may be overwritten below.
|
|
|
|
|
set_axis_is_at_home(X_AXIS);
|
|
|
|
@ -764,35 +764,37 @@ inline void invalid_extruder_error(const uint8_t e) {
|
|
|
|
|
* Perform a tool-change, which may result in moving the
|
|
|
|
|
* previous tool out of the way and the new tool into place.
|
|
|
|
|
*/
|
|
|
|
|
void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
|
|
|
|
|
if (tmp_extruder == active_extruder) return;
|
|
|
|
|
if (new_tool == active_extruder) return;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
const uint8_t old_tool = active_extruder;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MIXING_EXTRUDER)
|
|
|
|
|
|
|
|
|
|
UNUSED(no_move);
|
|
|
|
|
|
|
|
|
|
if (tmp_extruder >= MIXING_VIRTUAL_TOOLS)
|
|
|
|
|
return invalid_extruder_error(tmp_extruder);
|
|
|
|
|
if (new_tool >= MIXING_VIRTUAL_TOOLS)
|
|
|
|
|
return invalid_extruder_error(new_tool);
|
|
|
|
|
|
|
|
|
|
#if MIXING_VIRTUAL_TOOLS > 1
|
|
|
|
|
// T0-Tnnn: Switch virtual tool by changing the index to the mix
|
|
|
|
|
mixer.T(tmp_extruder);
|
|
|
|
|
mixer.T(new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(PRUSA_MMU2)
|
|
|
|
|
|
|
|
|
|
UNUSED(no_move);
|
|
|
|
|
|
|
|
|
|
mmu2.tool_change(tmp_extruder);
|
|
|
|
|
mmu2.tool_change(new_tool);
|
|
|
|
|
|
|
|
|
|
#elif EXTRUDERS < 2
|
|
|
|
|
|
|
|
|
|
UNUSED(no_move);
|
|
|
|
|
|
|
|
|
|
if (tmp_extruder) invalid_extruder_error(tmp_extruder);
|
|
|
|
|
if (new_tool) invalid_extruder_error(new_tool);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
#else // EXTRUDERS > 1
|
|
|
|
@ -800,12 +802,12 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_MIRRORED_MODE
|
|
|
|
|
if (tmp_extruder != 0 && dxc_is_duplicating())
|
|
|
|
|
return invalid_extruder_error(tmp_extruder);
|
|
|
|
|
if (new_tool != 0 && dxc_is_duplicating())
|
|
|
|
|
return invalid_extruder_error(new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (tmp_extruder >= EXTRUDERS)
|
|
|
|
|
return invalid_extruder_error(tmp_extruder);
|
|
|
|
|
if (new_tool >= EXTRUDERS)
|
|
|
|
|
return invalid_extruder_error(new_tool);
|
|
|
|
|
|
|
|
|
|
if (!no_move && !all_axes_homed()) {
|
|
|
|
|
no_move = true;
|
|
|
|
@ -827,7 +829,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
|
|
|
|
const bool should_swap = can_move_away && toolchange_settings.swap_length;
|
|
|
|
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
|
|
|
|
const bool too_cold = !DEBUGGING(DRYRUN) && (thermalManager.targetTooColdToExtrude(active_extruder) || thermalManager.targetTooColdToExtrude(tmp_extruder));
|
|
|
|
|
const bool too_cold = !DEBUGGING(DRYRUN) && (thermalManager.targetTooColdToExtrude(old_tool) || thermalManager.targetTooColdToExtrude(new_tool));
|
|
|
|
|
#else
|
|
|
|
|
constexpr bool too_cold = false;
|
|
|
|
|
#endif
|
|
|
|
@ -835,7 +837,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
if (too_cold) {
|
|
|
|
|
SERIAL_ECHO_MSG(MSG_ERR_HOTEND_TOO_COLD);
|
|
|
|
|
#if ENABLED(SINGLENOZZLE)
|
|
|
|
|
active_extruder = tmp_extruder;
|
|
|
|
|
active_extruder = new_tool;
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -843,8 +845,8 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
|
do_pause_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
|
|
|
|
|
#else
|
|
|
|
|
current_position[E_AXIS] -= toolchange_settings.swap_length / planner.e_factor[active_extruder];
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.retract_speed), active_extruder);
|
|
|
|
|
current_position[E_AXIS] -= toolchange_settings.swap_length / planner.e_factor[old_tool];
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.retract_speed), old_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -856,17 +858,17 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
TEMPORARY_BED_LEVELING_STATE(false);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (tmp_extruder != active_extruder) {
|
|
|
|
|
if (new_tool != old_tool) {
|
|
|
|
|
|
|
|
|
|
#if SWITCHING_NOZZLE_TWO_SERVOS
|
|
|
|
|
raise_nozzle(active_extruder);
|
|
|
|
|
raise_nozzle(old_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
REMEMBER(fr, feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S);
|
|
|
|
|
|
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS
|
|
|
|
|
#if HAS_HOTEND_OFFSET
|
|
|
|
|
#define _EXT_ARGS , active_extruder, tmp_extruder
|
|
|
|
|
#define _EXT_ARGS , old_tool, new_tool
|
|
|
|
|
#else
|
|
|
|
|
#define _EXT_ARGS
|
|
|
|
|
#endif
|
|
|
|
@ -891,7 +893,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
current_position[X_AXIS] = toolchange_settings.change_point.x;
|
|
|
|
|
current_position[Y_AXIS] = toolchange_settings.change_point.y;
|
|
|
|
|
#endif
|
|
|
|
|
planner.buffer_line(current_position, feedrate_mm_s, active_extruder);
|
|
|
|
|
planner.buffer_line(current_position, feedrate_mm_s, old_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -900,26 +902,26 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
|
constexpr float xdiff = 0;
|
|
|
|
|
#else
|
|
|
|
|
const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder];
|
|
|
|
|
const float xdiff = hotend_offset[X_AXIS][new_tool] - hotend_offset[X_AXIS][old_tool];
|
|
|
|
|
#endif
|
|
|
|
|
const float ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder],
|
|
|
|
|
zdiff = hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder];
|
|
|
|
|
const float ydiff = hotend_offset[Y_AXIS][new_tool] - hotend_offset[Y_AXIS][old_tool],
|
|
|
|
|
zdiff = hotend_offset[Z_AXIS][new_tool] - hotend_offset[Z_AXIS][old_tool];
|
|
|
|
|
#else
|
|
|
|
|
constexpr float xdiff = 0, ydiff = 0, zdiff = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
|
dualx_tool_change(tmp_extruder, no_move);
|
|
|
|
|
dualx_tool_change(new_tool, no_move);
|
|
|
|
|
#elif ENABLED(PARKING_EXTRUDER) // Dual Parking extruder
|
|
|
|
|
parking_extruder_tool_change(tmp_extruder, no_move);
|
|
|
|
|
parking_extruder_tool_change(new_tool, no_move);
|
|
|
|
|
#elif ENABLED(MAGNETIC_PARKING_EXTRUDER) // Magnetic Parking extruder
|
|
|
|
|
magnetic_parking_extruder_tool_change(tmp_extruder);
|
|
|
|
|
magnetic_parking_extruder_tool_change(new_tool);
|
|
|
|
|
#elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead
|
|
|
|
|
switching_toolhead_tool_change(tmp_extruder, no_move);
|
|
|
|
|
switching_toolhead_tool_change(new_tool, no_move);
|
|
|
|
|
#elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead
|
|
|
|
|
magnetic_switching_toolhead_tool_change(tmp_extruder, no_move);
|
|
|
|
|
magnetic_switching_toolhead_tool_change(new_tool, no_move);
|
|
|
|
|
#elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching ToolChanger
|
|
|
|
|
em_switching_toolhead_tool_change(tmp_extruder, no_move);
|
|
|
|
|
em_switching_toolhead_tool_change(new_tool, no_move);
|
|
|
|
|
#elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS // Switching Nozzle (single servo)
|
|
|
|
|
// Raise by a configured distance to avoid workpiece, except with
|
|
|
|
|
// SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead.
|
|
|
|
@ -928,7 +930,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max);
|
|
|
|
|
#endif
|
|
|
|
|
if (!no_move) fast_line_to_current(Z_AXIS);
|
|
|
|
|
move_nozzle_servo(tmp_extruder);
|
|
|
|
|
move_nozzle_servo(new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Offset Tool XY by { ", xdiff, ", ", ydiff, ", ", zdiff, " }");
|
|
|
|
@ -939,7 +941,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
current_position[Z_AXIS] += zdiff;
|
|
|
|
|
|
|
|
|
|
// Set the new active extruder if not already done in tool specific function above
|
|
|
|
|
active_extruder = tmp_extruder;
|
|
|
|
|
active_extruder = new_tool;
|
|
|
|
|
|
|
|
|
|
// Tell the planner the new "current position"
|
|
|
|
|
sync_plan_position();
|
|
|
|
@ -956,28 +958,30 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SINGLENOZZLE)
|
|
|
|
|
#if FAN_COUNT > 0
|
|
|
|
|
singlenozzle_fan_speed[active_extruder] = thermalManager.fan_speed[0];
|
|
|
|
|
thermalManager.fan_speed[0] = singlenozzle_fan_speed[tmp_extruder];
|
|
|
|
|
singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
|
|
|
|
|
thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target;
|
|
|
|
|
if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) {
|
|
|
|
|
thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0);
|
|
|
|
|
singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
|
|
|
|
|
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
|
|
|
|
|
thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
|
|
|
|
|
#if HAS_DISPLAY
|
|
|
|
|
thermalManager.set_heating_message(0);
|
|
|
|
|
#endif
|
|
|
|
|
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling
|
|
|
|
|
}
|
|
|
|
|
active_extruder = tmp_extruder;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
|
|
|
|
if (should_swap && !too_cold) {
|
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
|
do_pause_e_move(toolchange_settings.swap_length + toolchange_settings.extra_prime, MMM_TO_MMS(toolchange_settings.prime_speed));
|
|
|
|
|
do_pause_e_move(toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.prime_speed));
|
|
|
|
|
do_pause_e_move(toolchange_settings.extra_prime, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
|
|
|
|
#else
|
|
|
|
|
current_position[E_AXIS] += (toolchange_settings.swap_length + toolchange_settings.extra_prime) / planner.e_factor[tmp_extruder];
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder);
|
|
|
|
|
current_position[E_AXIS] += toolchange_settings.swap_length / planner.e_factor[new_tool];
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), new_tool);
|
|
|
|
|
current_position[E_AXIS] += toolchange_settings.extra_prime / planner.e_factor[new_tool];
|
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed * 0.2f), new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = current_position[E_AXIS] - (TOOLCHANGE_FIL_EXTRA_PRIME)));
|
|
|
|
@ -989,7 +993,7 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
// 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.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], new_tool);
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
@ -1022,14 +1026,14 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PRUSA_MMU2)
|
|
|
|
|
mmu2.tool_change(tmp_extruder);
|
|
|
|
|
mmu2.tool_change(new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if SWITCHING_NOZZLE_TWO_SERVOS
|
|
|
|
|
lower_nozzle(active_extruder);
|
|
|
|
|
lower_nozzle(new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
} // (tmp_extruder != active_extruder)
|
|
|
|
|
} // (new_tool != old_tool)
|
|
|
|
|
|
|
|
|
|
planner.synchronize();
|
|
|
|
|
|
|
|
|
@ -1039,8 +1043,8 @@ void tool_change(const uint8_t tmp_extruder, bool no_move/*=false*/) {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MK2_MULTIPLEXER)
|
|
|
|
|
if (tmp_extruder >= E_STEPPERS) return invalid_extruder_error(tmp_extruder);
|
|
|
|
|
select_multiplexed_stepper(tmp_extruder);
|
|
|
|
|
if (new_tool >= E_STEPPERS) return invalid_extruder_error(new_tool);
|
|
|
|
|
select_multiplexed_stepper(new_tool);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if DO_SWITCH_EXTRUDER
|
|
|
|
|