diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 0b32d8144f..9660322ed1 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -390,7 +390,8 @@ void GcodeSuite::G29() { stepper.synchronize(); // Disable auto bed leveling during G29 - planner.leveling_active = false; + // Be formal so G29 can be done successively without G28. + set_bed_leveling_enabled(false); if (!dryrun) { // Re-orient the current position without leveling @@ -404,7 +405,7 @@ void GcodeSuite::G29() { #if HAS_BED_PROBE // Deploy the probe. Probe will raise if needed. if (DEPLOY_PROBE()) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); return; } #endif @@ -421,10 +422,6 @@ void GcodeSuite::G29() { || left_probe_bed_position != bilinear_start[X_AXIS] || front_probe_bed_position != bilinear_start[Y_AXIS] ) { - if (dryrun) { - // Before reset bed level, re-enable to correct the position - planner.leveling_active = abl_should_enable; - } // Reset grid to 0.0 or "not probed". (Also disables ABL) reset_bed_level(); @@ -468,7 +465,7 @@ void GcodeSuite::G29() { #if HAS_SOFTWARE_ENDSTOPS soft_endstops_enabled = enable_soft_endstops; #endif - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); g29_in_progress = false; #if ENABLED(LCD_BED_LEVELING) lcd_wait_for_move = false; @@ -673,7 +670,7 @@ void GcodeSuite::G29() { measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); if (isnan(measured_z)) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); break; } @@ -709,7 +706,7 @@ void GcodeSuite::G29() { yProbe = points[i].y; measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); if (isnan(measured_z)) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); break; } points[i].z = measured_z; @@ -732,7 +729,7 @@ void GcodeSuite::G29() { // Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe. if (STOW_PROBE()) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); measured_z = NAN; } }