Pass the fade factor to mbl.get_z
This commit is contained in:
parent
85c2b96685
commit
84ff78c1e3
|
@ -83,7 +83,11 @@
|
|||
return z1 + delta_a * delta_z;
|
||||
}
|
||||
|
||||
float get_z(float x0, float y0) {
|
||||
float get_z(const float &x0, const float &y0
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
, const float &factor
|
||||
#endif
|
||||
) const {
|
||||
int8_t cx = cell_index_x(x0),
|
||||
cy = cell_index_y(y0);
|
||||
if (cx < 0 || cy < 0) return z_offset;
|
||||
|
@ -96,7 +100,12 @@
|
|||
float z0 = calc_z0(y0,
|
||||
get_probe_y(cy), z1,
|
||||
get_probe_y(cy + 1), z2);
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
return z0 * factor + z_offset;
|
||||
#else
|
||||
return z0 + z_offset;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -559,7 +559,7 @@ void Planner::check_axes_activity() {
|
|||
#if ENABLED(MESH_BED_LEVELING)
|
||||
|
||||
if (mbl.active())
|
||||
lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly)) * z_fade_factor;
|
||||
lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly), z_fade_factor);
|
||||
|
||||
#elif ABL_PLANAR
|
||||
|
||||
|
@ -595,7 +595,7 @@ void Planner::check_axes_activity() {
|
|||
|
||||
if (mbl.active()) {
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
const float c = mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
|
||||
const float c = mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]), 1.0);
|
||||
logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
|
||||
#else
|
||||
logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
|
||||
|
|
Loading…
Reference in a new issue