Skip to content
Snippets Groups Projects
Commit 32c607ff authored by Scott Lahteine's avatar Scott Lahteine
Browse files

Ensure fade factor is recalculated if fade height changes

parent ca1e4737
Branches
Tags
No related merge requests found
......@@ -139,6 +139,7 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
planner.z_fade_height = zfh;
planner.inverse_z_fade_height = RECIPROCAL(zfh);
planner.force_fade_recalc();
if (level_active) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
......
......@@ -202,6 +202,10 @@ class Planner {
*/
static uint32_t cutoff_long;
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
static float last_raw_lz;
#endif
#if ENABLED(DISABLE_INACTIVE_EXTRUDER)
/**
* Counters to manage disabling inactive extruders
......@@ -273,7 +277,7 @@ class Planner {
* Returns 0.0 if Z is past the specified 'Fade Height'.
*/
inline static float fade_scaling_factor_for_z(const float &lz) {
static float z_fade_factor = 1.0, last_raw_lz = -999.0;
static float z_fade_factor = 1.0;
if (z_fade_height) {
const float raw_lz = RAW_Z_POSITION(lz);
if (raw_lz >= z_fade_height) return 0.0;
......@@ -286,6 +290,8 @@ class Planner {
return 1.0;
}
FORCE_INLINE static void force_fade_recalc() { last_raw_lz = -999.999; }
#else
FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment