Browse Source

Fix auto bed leveling - turn on after successful G29

Scott Lahteine 8 years ago
parent
commit
e0e0166075
1 changed files with 16 additions and 14 deletions
  1. 16
    14
      Marlin/Marlin_main.cpp

+ 16
- 14
Marlin/Marlin_main.cpp View File

3516
     stepper.synchronize();
3516
     stepper.synchronize();
3517
 
3517
 
3518
     // Disable auto bed leveling during G29
3518
     // Disable auto bed leveling during G29
3519
-    bool abl_should_reenable = planner.abl_enabled;
3519
+    bool abl_should_enable = planner.abl_enabled;
3520
 
3520
 
3521
     planner.abl_enabled = false;
3521
     planner.abl_enabled = false;
3522
 
3522
 
3534
 
3534
 
3535
     // Deploy the probe. Probe will raise if needed.
3535
     // Deploy the probe. Probe will raise if needed.
3536
     if (DEPLOY_PROBE()) {
3536
     if (DEPLOY_PROBE()) {
3537
-      planner.abl_enabled = abl_should_reenable;
3537
+      planner.abl_enabled = abl_should_enable;
3538
       return;
3538
       return;
3539
     }
3539
     }
3540
 
3540
 
3555
           bilinear_grid_spacing[X_AXIS] = xGridSpacing;
3555
           bilinear_grid_spacing[X_AXIS] = xGridSpacing;
3556
           bilinear_grid_spacing[Y_AXIS] = yGridSpacing;
3556
           bilinear_grid_spacing[Y_AXIS] = yGridSpacing;
3557
           // Can't re-enable (on error) until the new grid is written
3557
           // Can't re-enable (on error) until the new grid is written
3558
-          abl_should_reenable = false;
3558
+          abl_should_enable = false;
3559
         }
3559
         }
3560
 
3560
 
3561
       #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
3561
       #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
3617
           measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
3617
           measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
3618
 
3618
 
3619
           if (measured_z == NAN) {
3619
           if (measured_z == NAN) {
3620
-            planner.abl_enabled = abl_should_reenable;
3620
+            planner.abl_enabled = abl_should_enable;
3621
             return;
3621
             return;
3622
           }
3622
           }
3623
 
3623
 
3661
       }
3661
       }
3662
 
3662
 
3663
       if (measured_z == NAN) {
3663
       if (measured_z == NAN) {
3664
-        planner.abl_enabled = abl_should_reenable;
3664
+        planner.abl_enabled = abl_should_enable;
3665
         return;
3665
         return;
3666
       }
3666
       }
3667
 
3667
 
3675
         planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
3675
         planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
3676
 
3676
 
3677
         // Can't re-enable (on error) until the new grid is written
3677
         // Can't re-enable (on error) until the new grid is written
3678
-        abl_should_reenable = false;
3678
+        abl_should_enable = false;
3679
       }
3679
       }
3680
 
3680
 
3681
     #endif // AUTO_BED_LEVELING_3POINT
3681
     #endif // AUTO_BED_LEVELING_3POINT
3682
 
3682
 
3683
     // Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe.
3683
     // Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe.
3684
     if (STOW_PROBE()) {
3684
     if (STOW_PROBE()) {
3685
-      planner.abl_enabled = abl_should_reenable;
3685
+      planner.abl_enabled = abl_should_enable;
3686
       return;
3686
       return;
3687
     }
3687
     }
3688
 
3688
 
3855
         current_position[Y_AXIS] = LOGICAL_Y_POSITION(y_dist) + Y_TILT_FULCRUM;
3855
         current_position[Y_AXIS] = LOGICAL_Y_POSITION(y_dist) + Y_TILT_FULCRUM;
3856
         current_position[Z_AXIS] = new_z;
3856
         current_position[Z_AXIS] = new_z;
3857
 
3857
 
3858
-        SYNC_PLAN_POSITION_KINEMATIC();
3859
-
3860
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3858
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3861
           if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position);
3859
           if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position);
3862
         #endif
3860
         #endif
3861
+
3862
+        SYNC_PLAN_POSITION_KINEMATIC();
3863
+        abl_should_enable = true;
3863
       }
3864
       }
3864
 
3865
 
3865
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
3866
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
3866
 
3867
 
3867
       if (!dryrun) {
3868
       if (!dryrun) {
3868
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3869
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3869
-          if (DEBUGGING(LEVELING)) SERIAL_ECHOPAIR("G29 uncorrected Z:", current_position[Z_AXIS]);
3870
+          if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("G29 uncorrected Z:", current_position[Z_AXIS]);
3870
         #endif
3871
         #endif
3871
 
3872
 
3872
         current_position[Z_AXIS] -= bilinear_z_offset(current_position);
3873
         current_position[Z_AXIS] -= bilinear_z_offset(current_position);
3873
 
3874
 
3874
-        SYNC_PLAN_POSITION_KINEMATIC();
3875
-
3876
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3875
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3877
-          if (DEBUGGING(LEVELING)) SERIAL_ECHOPAIR("G29 corrected Z:", current_position[Z_AXIS]);
3876
+          if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR(" corrected Z:", current_position[Z_AXIS]);
3878
         #endif
3877
         #endif
3878
+
3879
+        SYNC_PLAN_POSITION_KINEMATIC();
3880
+        abl_should_enable = true;
3879
       }
3881
       }
3880
 
3882
 
3881
     #endif // ABL_PLANAR
3883
     #endif // ABL_PLANAR
3897
     KEEPALIVE_STATE(IN_HANDLER);
3899
     KEEPALIVE_STATE(IN_HANDLER);
3898
 
3900
 
3899
     // Auto Bed Leveling is complete! Enable if possible.
3901
     // Auto Bed Leveling is complete! Enable if possible.
3900
-    planner.abl_enabled = dryrun ? abl_should_reenable : true;
3902
+    planner.abl_enabled = dryrun ? abl_should_enable : true;
3901
   }
3903
   }
3902
 
3904
 
3903
 #endif // HAS_ABL
3905
 #endif // HAS_ABL

Loading…
Cancel
Save