Use planner.leveling_active for all leveling systems

This commit is contained in:
Scott Lahteine
2017-10-13 17:21:25 -05:00
parent 32c607ffe2
commit 3e3911fb81
21 changed files with 143 additions and 180 deletions

View File

@ -164,15 +164,14 @@ class Planner {
max_jerk[XYZE], // The largest speed change requiring no acceleration
min_travel_feedrate_mm_s;
#if OLDSCHOOL_ABL
static bool abl_enabled; // Flag that bed leveling is enabled
#if HAS_LEVELING
static bool leveling_active; // Flag that bed leveling is enabled
#if ABL_PLANAR
static matrix_3x3 bed_level_matrix; // Transform to compensate for bed level
#endif
#endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
static float z_fade_height, inverse_z_fade_height;
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
static float z_fade_height, inverse_z_fade_height;
#endif
#endif
#if ENABLED(LIN_ADVANCE)
@ -292,6 +291,16 @@ class Planner {
FORCE_INLINE static void force_fade_recalc() { last_raw_lz = -999.999; }
FORCE_INLINE static void set_z_fade_height(const float &zfh) {
z_fade_height = zfh > 0 ? zfh : 0;
inverse_z_fade_height = RECIPROCAL(z_fade_height);
force_fade_recalc();
}
FORCE_INLINE static bool leveling_active_at_z(const float &lz) {
return !z_fade_height || RAW_Z_POSITION(lz) < z_fade_height;
}
#else
FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) {
@ -299,6 +308,8 @@ class Planner {
return 1.0;
}
FORCE_INLINE static bool leveling_active_at_z(const float &lz) { return true; }
#endif
#if PLANNER_LEVELING