MBL should add z_offset regardless of fade (#10307)

This commit is contained in:
Scott Lahteine 2018-04-04 18:27:09 -05:00 committed by GitHub
parent 9d2ef95f1d
commit a7e142460c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -647,12 +647,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
@ -661,18 +660,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
); );
@ -681,13 +678,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
@ -701,25 +692,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)