|
|
@ -138,30 +138,16 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
|
|
|
|
|
|
|
|
|
|
|
void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
|
|
|
|
void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
|
|
|
|
|
|
|
|
|
|
|
|
if (planner.z_fade_height == zfh) return; // do nothing if no change
|
|
|
|
if (planner.z_fade_height == zfh) return;
|
|
|
|
|
|
|
|
|
|
|
|
const bool level_active = planner.leveling_active;
|
|
|
|
const bool leveling_was_active = planner.leveling_active;
|
|
|
|
|
|
|
|
set_bed_leveling_enabled(false);
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
|
|
|
|
if (level_active) set_bed_leveling_enabled(false); // turn off before changing fade height for proper apply/unapply leveling to maintain current_position
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
planner.set_z_fade_height(zfh);
|
|
|
|
planner.set_z_fade_height(zfh);
|
|
|
|
|
|
|
|
|
|
|
|
if (level_active) {
|
|
|
|
if (leveling_was_active) {
|
|
|
|
const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
|
|
|
|
const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
|
|
set_bed_leveling_enabled(true);
|
|
|
|
set_bed_leveling_enabled(true); // turn back on after changing fade height
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
set_current_from_steppers_for_axis(
|
|
|
|
|
|
|
|
#if ABL_PLANAR
|
|
|
|
|
|
|
|
ALL_AXES
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
Z_AXIS
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (do_report && memcmp(oldpos, current_position, sizeof(oldpos)))
|
|
|
|
if (do_report && memcmp(oldpos, current_position, sizeof(oldpos)))
|
|
|
|
report_current_position();
|
|
|
|
report_current_position();
|
|
|
|
}
|
|
|
|
}
|
|
|
|