Tweaks to Z fade behavior

This commit is contained in:
Scott Lahteine 2019-09-26 01:15:35 -05:00
parent 1f48eaf03a
commit ee7558a622
4 changed files with 25 additions and 28 deletions

View File

@ -130,11 +130,12 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved(
*/ */
void reset_bed_level() { void reset_bed_level() {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("reset_bed_level"); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("reset_bed_level");
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.reset();
#else
set_bed_leveling_enabled(false); set_bed_leveling_enabled(false);
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
mbl.reset(); mbl.reset();
#elif ENABLED(AUTO_BED_LEVELING_UBL)
ubl.reset();
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] = bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] =
bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0; bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0;
@ -148,6 +149,7 @@ void reset_bed_level() {
#elif ABL_PLANAR #elif ABL_PLANAR
planner.bed_level_matrix.set_to_identity(); planner.bed_level_matrix.set_to_identity();
#endif #endif
#endif
} }
#if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING)

View File

@ -97,9 +97,6 @@
const bool was_enabled = planner.leveling_active; const bool was_enabled = planner.leveling_active;
set_bed_leveling_enabled(false); set_bed_leveling_enabled(false);
storage_slot = -1; storage_slot = -1;
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
planner.set_z_fade_height(10.0);
#endif
ZERO(z_values); ZERO(z_values);
#if ENABLED(EXTENSIBLE_UI) #if ENABLED(EXTENSIBLE_UI)
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)

View File

@ -2061,7 +2061,7 @@ void MarlinSettings::postprocess() {
} }
else { else {
ubl.reset(); ubl.reset();
DEBUG_ECHOLNPGM("UBL System reset()"); DEBUG_ECHOLNPGM("UBL reset");
} }
} }
#endif #endif

View File

@ -411,7 +411,7 @@ class Planner {
*/ */
static inline float fade_scaling_factor_for_z(const float &rz) { static inline float fade_scaling_factor_for_z(const float &rz) {
static float z_fade_factor = 1; static float z_fade_factor = 1;
if (z_fade_height) { if (!z_fade_height) return 1;
if (rz >= z_fade_height) return 0; if (rz >= z_fade_height) return 0;
if (last_fade_z != rz) { if (last_fade_z != rz) {
last_fade_z = rz; last_fade_z = rz;
@ -419,8 +419,6 @@ class Planner {
} }
return z_fade_factor; return z_fade_factor;
} }
return 1;
}
FORCE_INLINE static void force_fade_recalc() { last_fade_z = -999.999f; } FORCE_INLINE static void force_fade_recalc() { last_fade_z = -999.999f; }