Ensure fade factor is recalculated if fade height changes
This commit is contained in:
		
							parent
							
								
									ca1e47375c
								
							
						
					
					
						commit
						32c607ffe2
					
				| @ -139,6 +139,7 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) { | |||||||
| 
 | 
 | ||||||
|     planner.z_fade_height = zfh; |     planner.z_fade_height = zfh; | ||||||
|     planner.inverse_z_fade_height = RECIPROCAL(zfh); |     planner.inverse_z_fade_height = RECIPROCAL(zfh); | ||||||
|  |     planner.force_fade_recalc(); | ||||||
| 
 | 
 | ||||||
|     if (level_active) { |     if (level_active) { | ||||||
|       #if ENABLED(AUTO_BED_LEVELING_UBL) |       #if ENABLED(AUTO_BED_LEVELING_UBL) | ||||||
|  | |||||||
| @ -202,6 +202,10 @@ class Planner { | |||||||
|      */ |      */ | ||||||
|     static uint32_t cutoff_long; |     static uint32_t cutoff_long; | ||||||
| 
 | 
 | ||||||
|  |     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) | ||||||
|  |       static float last_raw_lz; | ||||||
|  |     #endif | ||||||
|  | 
 | ||||||
|     #if ENABLED(DISABLE_INACTIVE_EXTRUDER) |     #if ENABLED(DISABLE_INACTIVE_EXTRUDER) | ||||||
|       /**
 |       /**
 | ||||||
|        * Counters to manage disabling inactive extruders |        * Counters to manage disabling inactive extruders | ||||||
| @ -273,7 +277,7 @@ class Planner { | |||||||
|        *  Returns 0.0 if Z is past the specified 'Fade Height'. |        *  Returns 0.0 if Z is past the specified 'Fade Height'. | ||||||
|        */ |        */ | ||||||
|       inline static float fade_scaling_factor_for_z(const float &lz) { |       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) { |         if (z_fade_height) { | ||||||
|           const float raw_lz = RAW_Z_POSITION(lz); |           const float raw_lz = RAW_Z_POSITION(lz); | ||||||
|           if (raw_lz >= z_fade_height) return 0.0; |           if (raw_lz >= z_fade_height) return 0.0; | ||||||
| @ -286,6 +290,8 @@ class Planner { | |||||||
|         return 1.0; |         return 1.0; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |       FORCE_INLINE static void force_fade_recalc() { last_raw_lz = -999.999; } | ||||||
|  | 
 | ||||||
|     #else |     #else | ||||||
| 
 | 
 | ||||||
|       FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) { |       FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user