Browse Source

🚸 Restore active tool after ABL G29 (#23692)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
ellensp 3 years ago
parent
commit
0a24f858f3
No account linked to committer's email address

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -316,7 +316,7 @@ void unified_bed_leveling::G29() {
316 316
     planner.synchronize();
317 317
     // Send 'N' to force homing before G29 (internal only)
318 318
     if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes();
319
-    TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0));
319
+    TERN_(HAS_MULTI_HOTEND, if (active_extruder != 0) tool_change(0, true));
320 320
   }
321 321
 
322 322
   // Invalidate one or more nearby mesh points, possibly all.
@@ -663,7 +663,7 @@ void unified_bed_leveling::G29() {
663 663
     UNUSED(probe_deployed);
664 664
   #endif
665 665
 
666
-  TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index));
666
+  TERN_(HAS_MULTI_HOTEND, if (old_tool_index != 0) tool_change(old_tool_index));
667 667
   return;
668 668
 }
669 669
 

+ 1
- 1
Marlin/src/gcode/bedlevel/G35.cpp View File

@@ -155,7 +155,7 @@ void GcodeSuite::G35() {
155 155
 
156 156
   // Restore the active tool after homing
157 157
   #if HAS_MULTI_HOTEND
158
-    tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER)); // Fetch previous toolhead if not PARKING_EXTRUDER
158
+    if (old_tool_index != 0) tool_change(old_tool_index, DISABLED(PARKING_EXTRUDER)); // Fetch previous toolhead if not PARKING_EXTRUDER
159 159
   #endif
160 160
 
161 161
   #if BOTH(HAS_LEVELING, RESTORE_LEVELING_AFTER_G35)

+ 10
- 1
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -93,6 +93,10 @@ public:
93 93
   bool      dryrun,
94 94
             reenable;
95 95
 
96
+  #if HAS_MULTI_HOTEND
97
+    uint8_t tool_index;
98
+  #endif
99
+
96 100
   #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
97 101
     int abl_probe_index;
98 102
   #endif
@@ -263,7 +267,10 @@ G29_TYPE GcodeSuite::G29() {
263 267
    */
264 268
   if (!g29_in_progress) {
265 269
 
266
-    TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0));
270
+    #if HAS_MULTI_HOTEND
271
+      abl.tool_index = active_extruder;
272
+      if (active_extruder != 0) tool_change(0, true);
273
+    #endif
267 274
 
268 275
     #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
269 276
       abl.abl_probe_index = -1;
@@ -891,6 +898,8 @@ G29_TYPE GcodeSuite::G29() {
891 898
 
892 899
   TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());
893 900
 
901
+  TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index));
902
+
894 903
   report_current_position();
895 904
 
896 905
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));

Loading…
Cancel
Save