Cleanup of spacing and formatting

master
Scott Lahteine 8 years ago
parent 9f295581f0
commit e4937b0285

@ -2376,8 +2376,12 @@ static void clean_up_after_endstop_or_probe_move() {
(void)bilinear_z_offset(reset);
#endif
// Enable or disable leveling compensation in the planner
planner.abl_enabled = enable;
if (!enable)
// When disabling just get the current position from the steppers.
// This will yield the smallest error when first converted back to steps.
set_current_from_steppers_for_axis(
#if ABL_PLANAR
ALL_AXES
@ -2386,9 +2390,11 @@ static void clean_up_after_endstop_or_probe_move() {
#endif
);
else
// When enabling, remove compensation from the current position,
// so compensation will give the right stepper counts.
planner.unapply_leveling(current_position);
#endif
#endif // ABL
}
}
@ -2396,24 +2402,23 @@ static void clean_up_after_endstop_or_probe_move() {
void set_z_fade_height(const float zfh) {
const bool level_active = leveling_is_active();
#if ENABLED(AUTO_BED_LEVELING_UBL)
const bool level_active = leveling_is_active();
if (level_active) {
if (level_active)
set_bed_leveling_enabled(false); // turn off before changing fade height for proper apply/unapply leveling to maintain current_position
}
planner.z_fade_height = zfh;
planner.inverse_z_fade_height = RECIPROCAL(zfh);
if (level_active) {
if (level_active)
set_bed_leveling_enabled(true); // turn back on after changing fade height
}
#else
planner.z_fade_height = zfh;
planner.inverse_z_fade_height = RECIPROCAL(zfh);
if (leveling_is_active()) {
if (level_active) {
set_current_from_steppers_for_axis(
#if ABL_PLANAR
ALL_AXES

Loading…
Cancel
Save