Skip to content

Commit

Permalink
save / restore state correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 9, 2022
1 parent bdc29b0 commit eb3a34f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ class G29_State {
bool dryrun,
reenable;

#if HAS_MULTI_HOTEND
uint8_t tool_index;
#endif

#if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR)
int abl_probe_index;
#endif
Expand Down Expand Up @@ -264,7 +268,7 @@ G29_TYPE GcodeSuite::G29() {
if (!g29_in_progress) {

#if HAS_MULTI_HOTEND
const uint8_t old_active_extruder = active_extruder;
abl.tool_index = active_extruder;
if (active_extruder) tool_change(0);
#endif

Expand Down Expand Up @@ -455,8 +459,6 @@ G29_TYPE GcodeSuite::G29() {
}
#endif // AUTO_BED_LEVELING_BILINEAR

TERN_(HAS_MULTI_HOTEND, if (old_active_extruder != 0) tool_change(old_active_extruder));

} // !g29_in_progress

#if ENABLED(PROBE_MANUALLY)
Expand Down Expand Up @@ -896,6 +898,8 @@ G29_TYPE GcodeSuite::G29() {

TERN_(HAS_DWIN_E3V2_BASIC, DWIN_CompletedLeveling());

TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index));

report_current_position();

TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
Expand Down

0 comments on commit eb3a34f

Please sign in to comment.