Browse Source

Fix up xdiff, ydiff, zdiff in tool change

Followup to #12137
Scott Lahteine 6 years ago
parent
commit
81b1e9d272
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      Marlin/src/module/tool_change.cpp

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

@@ -610,11 +610,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
610 610
       }
611 611
 
612 612
       #if HOTENDS > 1
613
-        const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
614
-                    ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder],
613
+        #if ENABLED(DUAL_X_CARRIAGE)
614
+          constexpr float xdiff = 0;
615
+        #else
616
+          const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder];
617
+        #endif
618
+        const float ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder],
615 619
                     zdiff = hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder];
616 620
       #else
617
-        const float xdiff = 0, ydiff = 0, zdiff = 0;
621
+        constexpr float xdiff = 0, ydiff = 0, zdiff = 0;
618 622
       #endif
619 623
 
620 624
       #if ENABLED(DUAL_X_CARRIAGE)
@@ -643,9 +647,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
643 647
       #endif
644 648
 
645 649
       // The newly-selected extruder XY is actually at...
646
-      #if DISABLED(DUAL_X_CARRIAGE)
647
-        current_position[X_AXIS] += xdiff;
648
-      #endif
650
+      current_position[X_AXIS] += xdiff;
649 651
       current_position[Y_AXIS] += ydiff;
650 652
       current_position[Z_AXIS] += zdiff;
651 653
 

Loading…
Cancel
Save