Browse Source

Fix SWITCHING_NOZZLE compile error (#11657)

scott0122 7 years ago
parent
commit
6dc9553aa5
1 changed files with 5 additions and 6 deletions
  1. 5
    6
      Marlin/src/module/tool_change.cpp

+ 5
- 6
Marlin/src/module/tool_change.cpp View File

@@ -403,18 +403,17 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
403 403
             parking_extruder_tool_change(tmp_extruder, no_move);
404 404
           #endif
405 405
 
406
+          const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
407
+                      ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder],
408
+                      zdiff = hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder];
409
+
406 410
           #if ENABLED(SWITCHING_NOZZLE)
407 411
             // Always raise by at least 1 to avoid workpiece
408
-            const float zdiff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
409
-            current_position[Z_AXIS] += (zdiff > 0.0 ? zdiff : 0.0) + 1;
412
+            current_position[Z_AXIS] += (zdiff < 0.0 ? -zdiff : 0.0) + 1;
410 413
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
411 414
             move_nozzle_servo(tmp_extruder);
412 415
           #endif
413 416
 
414
-          const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
415
-                      ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder],
416
-                      zdiff = hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder];
417
-
418 417
           #if ENABLED(DEBUG_LEVELING_FEATURE)
419 418
             if (DEBUGGING(LEVELING)) {
420 419
               SERIAL_ECHOPAIR("Offset Tool XY by { ", xdiff);

Loading…
Cancel
Save