Browse Source

Tweaks to Z fade behavior

Scott Lahteine 5 years ago
parent
commit
ee7558a622

+ 18
- 16
Marlin/src/feature/bedlevel/bedlevel.cpp View File

@@ -130,23 +130,25 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved(
130 130
  */
131 131
 void reset_bed_level() {
132 132
   if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("reset_bed_level");
133
-  set_bed_leveling_enabled(false);
134
-  #if ENABLED(MESH_BED_LEVELING)
135
-    mbl.reset();
136
-  #elif ENABLED(AUTO_BED_LEVELING_UBL)
133
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
137 134
     ubl.reset();
138
-  #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
139
-    bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] =
140
-    bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0;
141
-    for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
142
-      for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) {
143
-        z_values[x][y] = NAN;
144
-        #if ENABLED(EXTENSIBLE_UI)
145
-          ExtUI::onMeshUpdate(x, y, 0);
146
-        #endif
147
-      }
148
-  #elif ABL_PLANAR
149
-    planner.bed_level_matrix.set_to_identity();
135
+  #else
136
+    set_bed_leveling_enabled(false);
137
+    #if ENABLED(MESH_BED_LEVELING)
138
+      mbl.reset();
139
+    #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
140
+      bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] =
141
+      bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0;
142
+      for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
143
+        for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) {
144
+          z_values[x][y] = NAN;
145
+          #if ENABLED(EXTENSIBLE_UI)
146
+            ExtUI::onMeshUpdate(x, y, 0);
147
+          #endif
148
+        }
149
+    #elif ABL_PLANAR
150
+      planner.bed_level_matrix.set_to_identity();
151
+    #endif
150 152
   #endif
151 153
 }
152 154
 

+ 0
- 3
Marlin/src/feature/bedlevel/ubl/ubl.cpp View File

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

+ 1
- 1
Marlin/src/module/configuration_store.cpp View File

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

+ 6
- 8
Marlin/src/module/planner.h View File

@@ -411,15 +411,13 @@ class Planner {
411 411
        */
412 412
       static inline float fade_scaling_factor_for_z(const float &rz) {
413 413
         static float z_fade_factor = 1;
414
-        if (z_fade_height) {
415
-          if (rz >= z_fade_height) return 0;
416
-          if (last_fade_z != rz) {
417
-            last_fade_z = rz;
418
-            z_fade_factor = 1 - rz * inverse_z_fade_height;
419
-          }
420
-          return z_fade_factor;
414
+        if (!z_fade_height) return 1;
415
+        if (rz >= z_fade_height) return 0;
416
+        if (last_fade_z != rz) {
417
+          last_fade_z = rz;
418
+          z_fade_factor = 1 - rz * inverse_z_fade_height;
421 419
         }
422
-        return 1;
420
+        return z_fade_factor;
423 421
       }
424 422
 
425 423
       FORCE_INLINE static void force_fade_recalc() { last_fade_z = -999.999f; }

Loading…
Cancel
Save