Merge pull request #5299 from thinkyhead/rc_bed_correction_fade

Add a fade factor for mesh leveling
This commit is contained in:
Scott Lahteine 2016-11-28 02:07:51 -06:00 committed by GitHub
commit c7935bb0d2
25 changed files with 345 additions and 11 deletions

View File

@ -745,6 +745,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -802,6 +807,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -2249,6 +2249,30 @@ static void clean_up_after_endstop_or_probe_move() {
#endif
}
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
void set_z_fade_height(const float zfh) {
planner.z_fade_height = zfh;
planner.inverse_z_fade_height = RECIPROCAL(zfh);
if (
#if ENABLED(MESH_BED_LEVELING)
mbl.active()
#else
planner.abl_enabled
#endif
) {
set_current_from_steppers_for_axis(
#if ABL_PLANAR
ALL_AXES
#else
Z_AXIS
#endif
);
}
}
#endif // LEVELING_FADE_HEIGHT
/**
* Reset calibration results to zero.
@ -6767,9 +6791,17 @@ void quickstop_stepper() {
#if PLANNER_LEVELING
/**
* M420: Enable/Disable Bed Leveling
* M420: Enable/Disable Bed Leveling and/or set the Z fade height.
*
* S[bool] Turns leveling on or off
* Z[height] Sets the Z fade height (0 or none to disable)
*/
inline void gcode_M420() { if (code_seen('S')) set_bed_leveling_enabled(code_value_bool()); }
inline void gcode_M420() {
if (code_seen('S')) set_bed_leveling_enabled(code_value_bool());
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
if (code_seen('Z')) set_z_fade_height(code_value_linear_units());
#endif
}
#endif
#if ENABLED(MESH_BED_LEVELING)

View File

@ -745,6 +745,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -802,6 +807,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -728,6 +728,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -785,6 +790,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -728,6 +728,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -785,6 +790,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -737,6 +737,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -794,6 +799,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -739,6 +739,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -796,6 +801,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -774,6 +774,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -831,6 +836,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -745,6 +745,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -802,6 +807,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -745,6 +745,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -802,6 +807,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -745,6 +745,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -802,6 +807,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -743,6 +743,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -800,6 +805,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -760,6 +760,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -817,6 +822,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -766,6 +766,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -823,6 +828,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -737,6 +737,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -794,6 +799,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -745,6 +745,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -802,6 +807,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -840,6 +840,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -899,6 +904,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -834,6 +834,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -893,6 +898,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -837,6 +837,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -896,6 +901,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -836,6 +836,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -895,6 +900,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -840,6 +840,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -899,6 +904,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -748,6 +748,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -805,6 +810,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -741,6 +741,11 @@
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis.
#endif // MANUAL_BED_LEVELING
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif // MESH_BED_LEVELING
//===========================================================================
@ -798,6 +803,13 @@
// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT
#endif
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
// 3 arbitrary points to probe.

View File

@ -104,6 +104,11 @@ float Planner::min_feedrate_mm_s,
matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
float Planner::z_fade_height = 0.0,
Planner::inverse_z_fade_height = 0.0;
#endif
#if ENABLED(AUTOTEMP)
float Planner::autotemp_max = 250,
Planner::autotemp_min = 210,
@ -531,10 +536,24 @@ void Planner::check_axes_activity() {
if (!abl_enabled) return;
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
static float z_fade_factor = 1.0, last_raw_lz = -999.0;
if (z_fade_height) {
const float raw_lz = RAW_Z_POSITION(lz);
if (raw_lz >= z_fade_height) return;
if (last_raw_lz != raw_lz) {
last_raw_lz = raw_lz;
z_fade_factor = 1.0 - raw_lz * inverse_z_fade_height;
}
}
else
z_fade_factor = 1.0;
#endif
#if ENABLED(MESH_BED_LEVELING)
if (mbl.active())
lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly)) * z_fade_factor;
#elif ABL_PLANAR
@ -551,7 +570,7 @@ void Planner::check_axes_activity() {
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
float tmp[XYZ] = { lx, ly, 0 };
lz += bilinear_z_offset(tmp);
lz += bilinear_z_offset(tmp) * z_fade_factor;
#endif
}
@ -562,10 +581,20 @@ void Planner::check_axes_activity() {
if (!abl_enabled) return;
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
if (z_fade_height && RAW_Z_POSITION(logical[Z_AXIS]) >= z_fade_height) return;
#endif
#if ENABLED(MESH_BED_LEVELING)
if (mbl.active())
logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
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]));
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]));
#endif
}
#elif ABL_PLANAR
@ -583,7 +612,12 @@ void Planner::check_axes_activity() {
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
logical[Z_AXIS] -= bilinear_z_offset(logical);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float c = bilinear_z_offset(logical);
logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
#else
logical[Z_AXIS] -= bilinear_z_offset(logical);
#endif
#endif
}

View File

@ -162,6 +162,10 @@ class Planner {
static matrix_3x3 bed_level_matrix; // Transform to compensate for bed level
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
static float z_fade_height, inverse_z_fade_height;
#endif
private:
/**
@ -180,10 +184,10 @@ class Planner {
*/
static float previous_nominal_speed;
/**
* Limit where 64bit math is necessary for acceleration calculation
*/
static uint32_t cutoff_long;
/**
* Limit where 64bit math is necessary for acceleration calculation
*/
static uint32_t cutoff_long;
#if ENABLED(DISABLE_INACTIVE_EXTRUDER)
/**