|
|
@ -7762,7 +7762,7 @@ inline void gcode_M211() { |
|
|
|
* T<tool> |
|
|
|
* X<xoffset> |
|
|
|
* Y<yoffset> |
|
|
|
* Z<zoffset> - Available with DUAL_X_CARRIAGE and SWITCHING_EXTRUDER |
|
|
|
* Z<zoffset> - Available with DUAL_X_CARRIAGE and SWITCHING_NOZZLE |
|
|
|
*/ |
|
|
|
inline void gcode_M218() { |
|
|
|
if (get_target_extruder_from_command(218) || target_extruder == 0) return; |
|
|
@ -7770,7 +7770,7 @@ inline void gcode_M211() { |
|
|
|
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value_linear_units(); |
|
|
|
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value_linear_units(); |
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER) |
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) |
|
|
|
if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value_linear_units(); |
|
|
|
#endif |
|
|
|
|
|
|
@ -7781,7 +7781,7 @@ inline void gcode_M211() { |
|
|
|
SERIAL_ECHO(hotend_offset[X_AXIS][e]); |
|
|
|
SERIAL_CHAR(','); |
|
|
|
SERIAL_ECHO(hotend_offset[Y_AXIS][e]); |
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER) |
|
|
|
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) |
|
|
|
SERIAL_CHAR(','); |
|
|
|
SERIAL_ECHO(hotend_offset[Z_AXIS][e]); |
|
|
|
#endif |
|
|
@ -9364,6 +9364,14 @@ inline void gcode_M999() { |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_NOZZLE) |
|
|
|
inline void move_nozzle_servo(uint8_t e) { |
|
|
|
const int angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; |
|
|
|
MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, angles[e]); |
|
|
|
safe_delay(500); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
inline void invalid_extruder_error(const uint8_t &e) { |
|
|
|
SERIAL_ECHO_START; |
|
|
|
SERIAL_CHAR('T'); |
|
|
@ -9511,7 +9519,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n |
|
|
|
// No extra case for HAS_ABL in DUAL_X_CARRIAGE. Does that mean they don't work together?
|
|
|
|
#else // !DUAL_X_CARRIAGE
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
#if ENABLED(SWITCHING_NOZZLE) |
|
|
|
// <0 if the new nozzle is higher, >0 if lower. A bigger raise when lower.
|
|
|
|
const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder], |
|
|
|
z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0); |
|
|
@ -9521,7 +9529,14 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n |
|
|
|
planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); |
|
|
|
stepper.synchronize(); |
|
|
|
|
|
|
|
move_extruder_servo(active_extruder); |
|
|
|
move_nozzle_servo(active_extruder); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
#if !(ENABLED(SWITCHING_NOZZLE) && (SWITCHING_EXTRUDER_SERVO_NR == SWITCHING_NOZZLE_SERVO_NR)) |
|
|
|
stepper.synchronize(); |
|
|
|
move_extruder_servo(active_extruder); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
/**
|
|
|
@ -9644,7 +9659,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n |
|
|
|
prepare_move_to_destination(); |
|
|
|
} |
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
#if ENABLED(SWITCHING_NOZZLE) |
|
|
|
// Move back down, if needed. (Including when the new tool is higher.)
|
|
|
|
if (z_raise != z_diff) { |
|
|
|
destination[Z_AXIS] += z_diff; |
|
|
@ -9672,6 +9687,11 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n |
|
|
|
UNUSED(fr_mm_s); |
|
|
|
UNUSED(no_move); |
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
stepper.synchronize(); |
|
|
|
move_extruder_servo(active_extruder); |
|
|
|
#endif |
|
|
|
|
|
|
|
#endif // HOTENDS <= 1
|
|
|
|
|
|
|
|
SERIAL_ECHO_START; |
|
|
|