🚸 Restore active tool after ABL G29 (#23692)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp 2022-02-10 05:46:53 +13:00 committed by Scott Lahteine
parent 38484c6eb6
commit 11071c7472
3 changed files with 13 additions and 4 deletions

View File

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

View File

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

View File

@ -93,6 +93,10 @@ public:
bool dryrun, bool dryrun,
reenable; reenable;
#if HAS_MULTI_HOTEND
uint8_t tool_index;
#endif
#if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
int abl_probe_index; int abl_probe_index;
#endif #endif
@ -263,7 +267,10 @@ G29_TYPE GcodeSuite::G29() {
*/ */
if (!g29_in_progress) { if (!g29_in_progress) {
TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0)); #if HAS_MULTI_HOTEND
abl.tool_index = active_extruder;
if (active_extruder != 0) tool_change(0, true);
#endif
#if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
abl.abl_probe_index = -1; abl.abl_probe_index = -1;
@ -891,6 +898,8 @@ G29_TYPE GcodeSuite::G29() {
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling()); TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());
TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index));
report_current_position(); report_current_position();
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE)); TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));