From 6dc9553aa5d8b35f54a3890e301c9a02c7aba308 Mon Sep 17 00:00:00 2001 From: scott0122 <39105828+scott0122@users.noreply.github.com> Date: Tue, 28 Aug 2018 10:25:25 +0800 Subject: [PATCH] Fix SWITCHING_NOZZLE compile error (#11657) --- Marlin/src/module/tool_change.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index b65dc617a8..e4c1cc0f50 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -403,18 +403,17 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n parking_extruder_tool_change(tmp_extruder, no_move); #endif - #if ENABLED(SWITCHING_NOZZLE) - // Always raise by at least 1 to avoid workpiece - const float zdiff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - current_position[Z_AXIS] += (zdiff > 0.0 ? zdiff : 0.0) + 1; - planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); - move_nozzle_servo(tmp_extruder); - #endif - const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder], 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]; + #if ENABLED(SWITCHING_NOZZLE) + // Always raise by at least 1 to avoid workpiece + current_position[Z_AXIS] += (zdiff < 0.0 ? -zdiff : 0.0) + 1; + planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); + move_nozzle_servo(tmp_extruder); + #endif + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOPAIR("Offset Tool XY by { ", xdiff);