소스 검색

Ensure fade factor is recalculated if fade height changes

Scott Lahteine 7 년 전
부모
커밋
32c607ffe2
2개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 1
    0
      Marlin/src/feature/bedlevel/bedlevel.cpp
  2. 7
    1
      Marlin/src/module/planner.h

+ 1
- 0
Marlin/src/feature/bedlevel/bedlevel.cpp 파일 보기

@@ -139,6 +139,7 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) {
139 139
 
140 140
     planner.z_fade_height = zfh;
141 141
     planner.inverse_z_fade_height = RECIPROCAL(zfh);
142
+    planner.force_fade_recalc();
142 143
 
143 144
     if (level_active) {
144 145
       #if ENABLED(AUTO_BED_LEVELING_UBL)

+ 7
- 1
Marlin/src/module/planner.h 파일 보기

@@ -202,6 +202,10 @@ class Planner {
202 202
      */
203 203
     static uint32_t cutoff_long;
204 204
 
205
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
206
+      static float last_raw_lz;
207
+    #endif
208
+
205 209
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
206 210
       /**
207 211
        * Counters to manage disabling inactive extruders
@@ -273,7 +277,7 @@ class Planner {
273 277
        *  Returns 0.0 if Z is past the specified 'Fade Height'.
274 278
        */
275 279
       inline static float fade_scaling_factor_for_z(const float &lz) {
276
-        static float z_fade_factor = 1.0, last_raw_lz = -999.0;
280
+        static float z_fade_factor = 1.0;
277 281
         if (z_fade_height) {
278 282
           const float raw_lz = RAW_Z_POSITION(lz);
279 283
           if (raw_lz >= z_fade_height) return 0.0;
@@ -286,6 +290,8 @@ class Planner {
286 290
         return 1.0;
287 291
       }
288 292
 
293
+      FORCE_INLINE static void force_fade_recalc() { last_raw_lz = -999.999; }
294
+
289 295
     #else
290 296
 
291 297
       FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) {

Loading…
취소
저장