Browse Source

Pass the fade factor to mbl.get_z

Scott Lahteine 8 years ago
parent
commit
84ff78c1e3
2 changed files with 13 additions and 4 deletions
  1. 11
    2
      Marlin/mesh_bed_leveling.h
  2. 2
    2
      Marlin/planner.cpp

+ 11
- 2
Marlin/mesh_bed_leveling.h View File

@@ -83,7 +83,11 @@
83 83
       return z1 + delta_a * delta_z;
84 84
     }
85 85
 
86
-    float get_z(float x0, float y0) {
86
+    float get_z(const float &x0, const float &y0
87
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
88
+        , const float &factor
89
+      #endif
90
+    ) const {
87 91
       int8_t cx = cell_index_x(x0),
88 92
              cy = cell_index_y(y0);
89 93
       if (cx < 0 || cy < 0) return z_offset;
@@ -96,7 +100,12 @@
96 100
       float z0 = calc_z0(y0,
97 101
                          get_probe_y(cy), z1,
98 102
                          get_probe_y(cy + 1), z2);
99
-      return z0 + z_offset;
103
+
104
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
105
+        return z0 * factor + z_offset;
106
+      #else
107
+        return z0 + z_offset;
108
+      #endif
100 109
     }
101 110
   };
102 111
 

+ 2
- 2
Marlin/planner.cpp View File

@@ -559,7 +559,7 @@ void Planner::check_axes_activity() {
559 559
     #if ENABLED(MESH_BED_LEVELING)
560 560
 
561 561
       if (mbl.active())
562
-        lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly)) * z_fade_factor;
562
+        lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly), z_fade_factor);
563 563
 
564 564
     #elif ABL_PLANAR
565 565
 
@@ -595,7 +595,7 @@ void Planner::check_axes_activity() {
595 595
 
596 596
       if (mbl.active()) {
597 597
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
598
-          const float c = mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
598
+          const float c = mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]), 1.0);
599 599
           logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
600 600
         #else
601 601
           logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));

Loading…
Cancel
Save