Add a fade factor for mesh leveling

This commit is contained in:
Scott Lahteine
2016-11-25 23:32:47 -06:00
parent 2a9b3376a9
commit f6f77d34a1
25 changed files with 345 additions and 11 deletions

View File

@ -2270,6 +2270,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.
@ -6788,9 +6812,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)