MBL should add z_offset regardless of fade (#10308)

This commit is contained in:
Scott Lahteine 2018-04-04 18:57:33 -05:00 committed by GitHub
parent 8bc93c6f2b
commit fe91514395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -658,12 +658,11 @@ void Planner::check_axes_activity() {
rx = dx + X_TILT_FULCRUM; rx = dx + X_TILT_FULCRUM;
ry = dy + Y_TILT_FULCRUM; ry = dy + Y_TILT_FULCRUM;
#else #elif HAS_MESH
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float fade_scaling_factor = fade_scaling_factor_for_z(rz); const float fade_scaling_factor = fade_scaling_factor_for_z(rz);
if (!fade_scaling_factor) return; #else
#elif HAS_MESH
constexpr float fade_scaling_factor = 1.0; constexpr float fade_scaling_factor = 1.0;
#endif #endif
@ -672,18 +671,16 @@ void Planner::check_axes_activity() {
#endif #endif
rz += ( rz += (
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(MESH_BED_LEVELING)
ubl.get_z_correction(rx, ry) * fade_scaling_factor
#elif ENABLED(MESH_BED_LEVELING)
mbl.get_z(rx, ry mbl.get_z(rx, ry
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
, fade_scaling_factor , fade_scaling_factor
#endif #endif
) )
#elif ENABLED(AUTO_BED_LEVELING_UBL)
fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(rx, ry) : 0.0
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_z_offset(raw) * fade_scaling_factor fade_scaling_factor ? fade_scaling_factor * bilinear_z_offset(raw) : 0.0
#else
0
#endif #endif
); );
@ -692,13 +689,7 @@ void Planner::check_axes_activity() {
void Planner::unapply_leveling(float raw[XYZ]) { void Planner::unapply_leveling(float raw[XYZ]) {
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) if (leveling_active) {
const float fade_scaling_factor = fade_scaling_factor_for_z(raw[Z_AXIS]);
#else
constexpr float fade_scaling_factor = 1.0;
#endif
if (leveling_active && fade_scaling_factor) {
#if ABL_PLANAR #if ABL_PLANAR
@ -712,25 +703,29 @@ void Planner::check_axes_activity() {
raw[X_AXIS] = dx + X_TILT_FULCRUM; raw[X_AXIS] = dx + X_TILT_FULCRUM;
raw[Y_AXIS] = dy + Y_TILT_FULCRUM; raw[Y_AXIS] = dy + Y_TILT_FULCRUM;
#else // !ABL_PLANAR #elif HAS_MESH
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float fade_scaling_factor = fade_scaling_factor_for_z(raw[Z_AXIS]);
#else
constexpr float fade_scaling_factor = 1.0;
#endif
raw[Z_AXIS] -= ( raw[Z_AXIS] -= (
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(MESH_BED_LEVELING)
ubl.get_z_correction(raw[X_AXIS], raw[Y_AXIS]) * fade_scaling_factor
#elif ENABLED(MESH_BED_LEVELING)
mbl.get_z(raw[X_AXIS], raw[Y_AXIS] mbl.get_z(raw[X_AXIS], raw[Y_AXIS]
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
, fade_scaling_factor , fade_scaling_factor
#endif #endif
) )
#elif ENABLED(AUTO_BED_LEVELING_UBL)
fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw[X_AXIS], raw[Y_AXIS]) : 0.0
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_z_offset(raw) * fade_scaling_factor fade_scaling_factor ? fade_scaling_factor * bilinear_z_offset(raw) : 0.0
#else
0
#endif #endif
); );
#endif // !ABL_PLANAR #endif
} }
#if ENABLED(SKEW_CORRECTION) #if ENABLED(SKEW_CORRECTION)