Browse Source

Allow consecutive uses of G29

Scott Lahteine 7 years ago
parent
commit
f2731c9f93
1 changed files with 7 additions and 10 deletions
  1. 7
    10
      Marlin/src/gcode/bedlevel/abl/G29.cpp

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

@@ -390,7 +390,8 @@ void GcodeSuite::G29() {
390 390
     stepper.synchronize();
391 391
 
392 392
     // Disable auto bed leveling during G29
393
-    planner.leveling_active = false;
393
+    // Be formal so G29 can be done successively without G28.
394
+    set_bed_leveling_enabled(false);
394 395
 
395 396
     if (!dryrun) {
396 397
       // Re-orient the current position without leveling
@@ -404,7 +405,7 @@ void GcodeSuite::G29() {
404 405
     #if HAS_BED_PROBE
405 406
       // Deploy the probe. Probe will raise if needed.
406 407
       if (DEPLOY_PROBE()) {
407
-        planner.leveling_active = abl_should_enable;
408
+        set_bed_leveling_enabled(abl_should_enable);
408 409
         return;
409 410
       }
410 411
     #endif
@@ -421,10 +422,6 @@ void GcodeSuite::G29() {
421 422
         || left_probe_bed_position != bilinear_start[X_AXIS]
422 423
         || front_probe_bed_position != bilinear_start[Y_AXIS]
423 424
       ) {
424
-        if (dryrun) {
425
-          // Before reset bed level, re-enable to correct the position
426
-          planner.leveling_active = abl_should_enable;
427
-        }
428 425
         // Reset grid to 0.0 or "not probed". (Also disables ABL)
429 426
         reset_bed_level();
430 427
 
@@ -468,7 +465,7 @@ void GcodeSuite::G29() {
468 465
       #if HAS_SOFTWARE_ENDSTOPS
469 466
         soft_endstops_enabled = enable_soft_endstops;
470 467
       #endif
471
-      planner.leveling_active = abl_should_enable;
468
+      set_bed_leveling_enabled(abl_should_enable);
472 469
       g29_in_progress = false;
473 470
       #if ENABLED(LCD_BED_LEVELING)
474 471
         lcd_wait_for_move = false;
@@ -673,7 +670,7 @@ void GcodeSuite::G29() {
673 670
           measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
674 671
 
675 672
           if (isnan(measured_z)) {
676
-            planner.leveling_active = abl_should_enable;
673
+            set_bed_leveling_enabled(abl_should_enable);
677 674
             break;
678 675
           }
679 676
 
@@ -709,7 +706,7 @@ void GcodeSuite::G29() {
709 706
         yProbe = points[i].y;
710 707
         measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
711 708
         if (isnan(measured_z)) {
712
-          planner.leveling_active = abl_should_enable;
709
+          set_bed_leveling_enabled(abl_should_enable);
713 710
           break;
714 711
         }
715 712
         points[i].z = measured_z;
@@ -732,7 +729,7 @@ void GcodeSuite::G29() {
732 729
 
733 730
     // Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe.
734 731
     if (STOW_PROBE()) {
735
-      planner.leveling_active = abl_should_enable;
732
+      set_bed_leveling_enabled(abl_should_enable);
736 733
       measured_z = NAN;
737 734
     }
738 735
   }

Loading…
Cancel
Save