Use planner.leveling_active for all leveling systems
This commit is contained in:
@ -105,14 +105,13 @@ void GcodeSuite::M420() {
|
||||
}
|
||||
|
||||
const bool to_enable = parser.boolval('S');
|
||||
if (parser.seen('S'))
|
||||
set_bed_leveling_enabled(to_enable);
|
||||
if (parser.seen('S')) set_bed_leveling_enabled(to_enable);
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
if (parser.seen('Z')) set_z_fade_height(parser.value_linear_units());
|
||||
#endif
|
||||
|
||||
const bool new_status = LEVELING_IS_ACTIVE();
|
||||
const bool new_status = planner.leveling_active;
|
||||
|
||||
if (to_enable && !new_status) {
|
||||
SERIAL_ERROR_START();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
void echo_not_entered() { SERIAL_PROTOCOLLNPGM(" not entered."); }
|
||||
|
||||
void mesh_probing_done() {
|
||||
mbl.set_has_mesh(true);
|
||||
mbl.has_mesh = true;
|
||||
gcode.home_all_axes();
|
||||
set_bed_leveling_enabled(true);
|
||||
#if ENABLED(MESH_G28_REST_ORIGIN)
|
||||
@ -92,7 +92,7 @@ void GcodeSuite::G29() {
|
||||
switch (state) {
|
||||
case MeshReport:
|
||||
if (leveling_is_valid()) {
|
||||
SERIAL_PROTOCOLLNPAIR("State: ", LEVELING_IS_ACTIVE() ? MSG_ON : MSG_OFF);
|
||||
SERIAL_PROTOCOLLNPAIR("State: ", planner.leveling_active ? MSG_ON : MSG_OFF);
|
||||
mbl_mesh_report();
|
||||
}
|
||||
else
|
||||
|
@ -157,7 +157,7 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
// Disable the leveling matrix before homing
|
||||
#if HAS_LEVELING
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
const bool ubl_state_at_entry = LEVELING_IS_ACTIVE();
|
||||
const bool ubl_state_at_entry = planner.leveling_active;
|
||||
#endif
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ void GcodeSuite::M48() {
|
||||
// Disable bed level correction in M48 because we want the raw data when we probe
|
||||
|
||||
#if HAS_LEVELING
|
||||
const bool was_enabled = LEVELING_IS_ACTIVE();
|
||||
const bool was_enabled = planner.leveling_active;
|
||||
set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user