From 4250a9890818372f13da6baab1dd09170191dbb1 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Wed, 26 Feb 2020 01:12:14 -0500 Subject: [PATCH] Toolchange improvements (#16979) --- Marlin/src/module/tool_change.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 28baa4047d..cf104e7b5a 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -45,8 +45,8 @@ #endif #endif -#if ENABLED(MAGNETIC_PARKING_EXTRUDER) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0) - #include "../gcode/gcode.h" // for dwell() +#if ENABLED(MAGNETIC_PARKING_EXTRUDER) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0) + #include "../gcode/gcode.h" #endif #if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SWITCHING_TOOLHEAD) @@ -861,7 +861,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { } #endif // TOOLCHANGE_FILAMENT_SWAP - #if HAS_LEVELING + #if HAS_LEVELING && DISABLED(SINGLENOZZLE) // Set current position to the physical position TEMPORARY_BED_LEVELING_STATE(false); #endif @@ -1068,7 +1068,8 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #endif #ifdef EVENT_GCODE_AFTER_TOOLCHANGE - gcode.process_subcommands_now_P(EVENT_GCODE_AFTER_TOOLCHANGE); + if (!no_move) + gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_AFTER_TOOLCHANGE)); #endif SERIAL_ECHO_START();