🚸 Use Tool 0 for G30 (#24511)

This commit is contained in:
InsanityAutomation 2022-07-19 18:33:49 -04:00 committed by Scott Lahteine
parent f5b972bb10
commit feafa321d7

View File

@ -33,6 +33,10 @@
#include "../../feature/probe_temp_comp.h" #include "../../feature/probe_temp_comp.h"
#endif #endif
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#if ENABLED(DWIN_LCD_PROUI) #if ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/marlinui.h" #include "../../lcd/marlinui.h"
#endif #endif
@ -49,6 +53,11 @@
*/ */
void GcodeSuite::G30() { void GcodeSuite::G30() {
#if HAS_MULTI_HOTEND
const uint8_t old_tool_index = active_extruder;
tool_change(0);
#endif
const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x), const xy_pos_t pos = { parser.linearval('X', current_position.x + probe.offset_xy.x),
parser.linearval('Y', current_position.y + probe.offset_xy.y) }; parser.linearval('Y', current_position.y + probe.offset_xy.y) };
@ -57,9 +66,8 @@ void GcodeSuite::G30() {
SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT));
LCD_MESSAGE(MSG_ZPROBE_OUT); LCD_MESSAGE(MSG_ZPROBE_OUT);
#endif #endif
return;
} }
else {
// Disable leveling so the planner won't mess with us // Disable leveling so the planner won't mess with us
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
@ -93,4 +101,8 @@ void GcodeSuite::G30() {
report_current_position(); report_current_position();
} }
// Restore the active tool
TERN_(HAS_MULTI_HOTEND, tool_change(old_tool_index));
}
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE