Use planner.leveling_active for all leveling systems

This commit is contained in:
Scott Lahteine
2017-10-13 17:21:25 -05:00
parent 32c607ffe2
commit 3e3911fb81
21 changed files with 143 additions and 180 deletions

View File

@ -247,7 +247,7 @@ void GcodeSuite::G29() {
abl_probe_index = -1;
#endif
abl_should_enable = LEVELING_IS_ACTIVE();
abl_should_enable = planner.leveling_active;
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@ -388,7 +388,7 @@ void GcodeSuite::G29() {
stepper.synchronize();
// Disable auto bed leveling during G29
planner.abl_enabled = false;
planner.leveling_active = false;
if (!dryrun) {
// Re-orient the current position without leveling
@ -402,7 +402,7 @@ void GcodeSuite::G29() {
#if HAS_BED_PROBE
// Deploy the probe. Probe will raise if needed.
if (DEPLOY_PROBE()) {
planner.abl_enabled = abl_should_enable;
planner.leveling_active = abl_should_enable;
return;
}
#endif
@ -421,7 +421,7 @@ void GcodeSuite::G29() {
) {
if (dryrun) {
// Before reset bed level, re-enable to correct the position
planner.abl_enabled = abl_should_enable;
planner.leveling_active = abl_should_enable;
}
// Reset grid to 0.0 or "not probed". (Also disables ABL)
reset_bed_level();
@ -466,7 +466,7 @@ void GcodeSuite::G29() {
#if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops;
#endif
planner.abl_enabled = abl_should_enable;
planner.leveling_active = abl_should_enable;
g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
@ -669,7 +669,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.abl_enabled = abl_should_enable;
planner.leveling_active = abl_should_enable;
break;
}
@ -705,7 +705,7 @@ void GcodeSuite::G29() {
yProbe = LOGICAL_Y_POSITION(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.abl_enabled = abl_should_enable;
planner.leveling_active = abl_should_enable;
break;
}
points[i].z = measured_z;
@ -728,7 +728,7 @@ void GcodeSuite::G29() {
// Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe.
if (STOW_PROBE()) {
planner.abl_enabled = abl_should_enable;
planner.leveling_active = abl_should_enable;
measured_z = NAN;
}
}
@ -896,9 +896,9 @@ void GcodeSuite::G29() {
float converted[XYZ];
COPY(converted, current_position);
planner.abl_enabled = true;
planner.leveling_active = true;
planner.unapply_leveling(converted); // use conversion machinery
planner.abl_enabled = false;
planner.leveling_active = false;
// Use the last measured distance to the bed, if possible
if ( NEAR(current_position[X_AXIS], xProbe - (X_PROBE_OFFSET_FROM_EXTRUDER))
@ -950,7 +950,7 @@ void GcodeSuite::G29() {
#endif
// Auto Bed Leveling is complete! Enable if possible.
planner.abl_enabled = dryrun ? abl_should_enable : true;
planner.leveling_active = dryrun ? abl_should_enable : true;
} // !isnan(measured_z)
// Restore state after probing
@ -964,7 +964,7 @@ void GcodeSuite::G29() {
KEEPALIVE_STATE(IN_HANDLER);
if (LEVELING_IS_ACTIVE())
if (planner.leveling_active)
SYNC_PLAN_POSITION_KINEMATIC();
}