Move fade_scaling_factor_for_z to Planner
This commit is contained in:
parent
8e808fcadc
commit
88857e8028
12 changed files with 266 additions and 304 deletions
27
Marlin/ubl.h
27
Marlin/ubl.h
|
|
@ -84,8 +84,6 @@
|
|||
class unified_bed_leveling {
|
||||
private:
|
||||
|
||||
static float last_specified_z;
|
||||
|
||||
static int g29_verbose_level,
|
||||
g29_phase_value,
|
||||
g29_repetition_cnt,
|
||||
|
|
@ -361,31 +359,6 @@
|
|||
return z0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sets the Z leveling fade factor based on the given Z height,
|
||||
* only re-calculating when necessary.
|
||||
*
|
||||
* Returns 1.0 if planner.z_fade_height is 0.0.
|
||||
* Returns 0.0 if Z is past the specified 'Fade Height'.
|
||||
*/
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
static inline float fade_scaling_factor_for_z(const float &lz) {
|
||||
if (planner.z_fade_height == 0.0) return 1.0;
|
||||
static float fade_scaling_factor = 1.0;
|
||||
const float rz = RAW_Z_POSITION(lz);
|
||||
if (last_specified_z != rz) {
|
||||
last_specified_z = rz;
|
||||
fade_scaling_factor =
|
||||
rz < planner.z_fade_height
|
||||
? 1.0 - (rz * planner.inverse_z_fade_height)
|
||||
: 0.0;
|
||||
}
|
||||
return fade_scaling_factor;
|
||||
}
|
||||
#else
|
||||
FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) { return 1.0; }
|
||||
#endif
|
||||
|
||||
FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) {
|
||||
return i < GRID_MAX_POINTS_X ? pgm_read_float(&_mesh_index_to_xpos[i]) : UBL_MESH_MIN_X + i * (MESH_X_DIST);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue