|
@@ -99,7 +99,21 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
|
99
|
99
|
planner.unapply_leveling(current_position);
|
100
|
100
|
}
|
101
|
101
|
#else
|
102
|
|
- planner.leveling_active = enable; // just flip the bit, current_position will be wrong until next move.
|
|
102
|
+ // UBL equivalents for apply/unapply_leveling
|
|
103
|
+ #if ENABLED(SKEW_CORRECTION)
|
|
104
|
+ float pos[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
|
|
105
|
+ planner.skew(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS]);
|
|
106
|
+ #else
|
|
107
|
+ const float (&pos)[XYZE] = current_position;
|
|
108
|
+ #endif
|
|
109
|
+ if (planner.leveling_active) {
|
|
110
|
+ current_position[Z_AXIS] += ubl.get_z_correction(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS]);
|
|
111
|
+ planner.leveling_active = false;
|
|
112
|
+ }
|
|
113
|
+ else {
|
|
114
|
+ planner.leveling_active = true;
|
|
115
|
+ current_position[Z_AXIS] -= ubl.get_z_correction(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS]);
|
|
116
|
+ }
|
103
|
117
|
#endif
|
104
|
118
|
|
105
|
119
|
#else // OLDSCHOOL_ABL
|