|
@@ -138,30 +138,16 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
138
|
138
|
|
139
|
139
|
void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
|
140
|
140
|
|
141
|
|
- if (planner.z_fade_height == zfh) return; // do nothing if no change
|
|
141
|
+ if (planner.z_fade_height == zfh) return;
|
142
|
142
|
|
143
|
|
- const bool level_active = planner.leveling_active;
|
144
|
|
-
|
145
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
146
|
|
- if (level_active) set_bed_leveling_enabled(false); // turn off before changing fade height for proper apply/unapply leveling to maintain current_position
|
147
|
|
- #endif
|
|
143
|
+ const bool leveling_was_active = planner.leveling_active;
|
|
144
|
+ set_bed_leveling_enabled(false);
|
148
|
145
|
|
149
|
146
|
planner.set_z_fade_height(zfh);
|
150
|
147
|
|
151
|
|
- if (level_active) {
|
|
148
|
+ if (leveling_was_active) {
|
152
|
149
|
const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
|
153
|
|
- #if ENABLED(AUTO_BED_LEVELING_UBL)
|
154
|
|
- set_bed_leveling_enabled(true); // turn back on after changing fade height
|
155
|
|
- #else
|
156
|
|
- set_current_from_steppers_for_axis(
|
157
|
|
- #if ABL_PLANAR
|
158
|
|
- ALL_AXES
|
159
|
|
- #else
|
160
|
|
- Z_AXIS
|
161
|
|
- #endif
|
162
|
|
- );
|
163
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
164
|
|
- #endif
|
|
150
|
+ set_bed_leveling_enabled(true);
|
165
|
151
|
if (do_report && memcmp(oldpos, current_position, sizeof(oldpos)))
|
166
|
152
|
report_current_position();
|
167
|
153
|
}
|