Browse Source

Merge pull request #5299 from thinkyhead/rc_bed_correction_fade

Add a fade factor for mesh leveling
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
c7935bb0d2
  1. 12
      Marlin/Configuration.h
  2. 36
      Marlin/Marlin_main.cpp
  3. 12
      Marlin/example_configurations/Cartesio/Configuration.h
  4. 12
      Marlin/example_configurations/Felix/Configuration.h
  5. 12
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  6. 12
      Marlin/example_configurations/Hephestos/Configuration.h
  7. 12
      Marlin/example_configurations/Hephestos_2/Configuration.h
  8. 12
      Marlin/example_configurations/K8200/Configuration.h
  9. 12
      Marlin/example_configurations/K8400/Configuration.h
  10. 12
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  11. 12
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  12. 12
      Marlin/example_configurations/RigidBot/Configuration.h
  13. 12
      Marlin/example_configurations/SCARA/Configuration.h
  14. 12
      Marlin/example_configurations/TAZ4/Configuration.h
  15. 12
      Marlin/example_configurations/WITBOX/Configuration.h
  16. 12
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  17. 12
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  18. 12
      Marlin/example_configurations/delta/generic/Configuration.h
  19. 12
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  20. 12
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  21. 12
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  22. 12
      Marlin/example_configurations/makibox/Configuration.h
  23. 12
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  24. 44
      Marlin/planner.cpp
  25. 12
      Marlin/planner.h

12
Marlin/Configuration.h

@ -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.

36
Marlin/Marlin_main.cpp

@ -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)

12
Marlin/example_configurations/Cartesio/Configuration.h

@ -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.

12
Marlin/example_configurations/Felix/Configuration.h

@ -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.

12
Marlin/example_configurations/Felix/DUAL/Configuration.h

@ -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.

12
Marlin/example_configurations/Hephestos/Configuration.h

@ -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.

12
Marlin/example_configurations/Hephestos_2/Configuration.h

@ -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.

12
Marlin/example_configurations/K8200/Configuration.h

@ -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.

12
Marlin/example_configurations/K8400/Configuration.h

@ -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.

12
Marlin/example_configurations/K8400/Dual-head/Configuration.h

@ -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.

12
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h

@ -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.

12
Marlin/example_configurations/RigidBot/Configuration.h

@ -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.

12
Marlin/example_configurations/SCARA/Configuration.h

@ -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.

12
Marlin/example_configurations/TAZ4/Configuration.h

@ -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.

12
Marlin/example_configurations/WITBOX/Configuration.h

@ -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.

12
Marlin/example_configurations/adafruit/ST7565/Configuration.h

@ -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.

12
Marlin/example_configurations/delta/biv2.5/Configuration.h

@ -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.

12
Marlin/example_configurations/delta/generic/Configuration.h

@ -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.

12
Marlin/example_configurations/delta/kossel_mini/Configuration.h

@ -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.

12
Marlin/example_configurations/delta/kossel_pro/Configuration.h

@ -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.

12
Marlin/example_configurations/delta/kossel_xl/Configuration.h

@ -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.

12
Marlin/example_configurations/makibox/Configuration.h

@ -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.

12
Marlin/example_configurations/tvrrug/Round2/Configuration.h

@ -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.

44
Marlin/planner.cpp

@ -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
}

12
Marlin/planner.h

@ -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)
/**

Loading…
Cancel
Save