From b99a26d6ab1179f5bb8c26f50ab17cccb3a806fd Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Tue, 10 Sep 2024 04:07:44 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20Fix=20Dual=20Servo=20Toolchan?= =?UTF-8?q?ge=20Z=20Creep=20(#27381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/tool_change.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 80ebe71b2a..5d34dc3aa5 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1225,8 +1225,6 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { } #endif - TERN_(SWITCHING_NOZZLE_TWO_SERVOS, raise_nozzle(old_tool)); - REMEMBER(fr, feedrate_mm_s, XY_PROBE_FEEDRATE_MM_S); #if HAS_SOFTWARE_ENDSTOPS @@ -1290,20 +1288,23 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { magnetic_switching_toolhead_tool_change(new_tool, no_move); #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching ToolChanger em_switching_toolhead_tool_change(new_tool, no_move); - #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS // Switching Nozzle (single servo) + #elif ENABLED(SWITCHING_NOZZLE) // Switching Nozzle // Raise by a configured distance to avoid workpiece, except with // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead. + TERN_(SWITCHING_NOZZLE_TWO_SERVOS, raise_nozzle(old_tool)); if (!no_move) { const float newz = current_position.z + _MAX(-diff.z, 0.0); - // Check if Z has space to compensate at least z_offset, and if not, just abort now const float maxz = _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS); if (newz > maxz) return; - current_position.z = _MIN(newz + toolchange_settings.z_raise, maxz); fast_line_to_current(Z_AXIS); } - move_nozzle_servo(new_tool); + #if SWITCHING_NOZZLE_TWO_SERVOS // Switching Nozzle with two servos + lower_nozzle(new_tool); + #else + move_nozzle_servo(new_tool); + #endif #elif ANY(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) if (!no_move) { current_position.z = _MIN(current_position.z + toolchange_settings.z_raise, _MIN(TERN(HAS_SOFTWARE_ENDSTOPS, soft_endstop.max.z, Z_MAX_POS), Z_MAX_POS)); @@ -1372,7 +1373,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #if ENABLED(TOOLCHANGE_PARK) if (toolchange_settings.enable_park) do_blocking_move_to_xy_z(destination, destination.z, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE)); #else - do_blocking_move_to_xy(destination, planner.settings.max_feedrate_mm_s[X_AXIS]); + do_blocking_move_to_xy(destination, planner.settings.max_feedrate_mm_s[X_AXIS]* 0.5f); // If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE below. #if NONE(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE) @@ -1405,7 +1406,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #endif TERN_(DUAL_X_CARRIAGE, idex_set_parked(false)); - } + } // should_move #if HAS_SWITCHING_NOZZLE // Move back down. (Including when the new tool is higher.) @@ -1413,8 +1414,6 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]); #endif - TERN_(SWITCHING_NOZZLE_TWO_SERVOS, lower_nozzle(new_tool)); - } // (new_tool != old_tool) planner.synchronize(); @@ -1510,7 +1509,8 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (TERN1(DUAL_X_CARRIAGE, dual_x_carriage_mode == DXC_AUTO_PARK_MODE)) gcode.process_subcommands_now(F(EVENT_GCODE_AFTER_TOOLCHANGE)); #endif - } + + } // !no_move SERIAL_ECHOLNPGM(STR_ACTIVE_EXTRUDER, active_extruder);