Merge pull request #5299 from thinkyhead/rc_bed_correction_fade
Add a fade factor for mesh leveling
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user