Browse Source

Add a fade factor for mesh leveling

Scott Lahteine 7 years ago
parent
commit
f6f77d34a1
25 changed files with 345 additions and 11 deletions
  1. 12
    0
      Marlin/Configuration.h
  2. 34
    2
      Marlin/Marlin_main.cpp
  3. 12
    0
      Marlin/example_configurations/Cartesio/Configuration.h
  4. 12
    0
      Marlin/example_configurations/Felix/Configuration.h
  5. 12
    0
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  6. 12
    0
      Marlin/example_configurations/Hephestos/Configuration.h
  7. 12
    0
      Marlin/example_configurations/Hephestos_2/Configuration.h
  8. 12
    0
      Marlin/example_configurations/K8200/Configuration.h
  9. 12
    0
      Marlin/example_configurations/K8400/Configuration.h
  10. 12
    0
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  11. 12
    0
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  12. 12
    0
      Marlin/example_configurations/RigidBot/Configuration.h
  13. 12
    0
      Marlin/example_configurations/SCARA/Configuration.h
  14. 12
    0
      Marlin/example_configurations/TAZ4/Configuration.h
  15. 12
    0
      Marlin/example_configurations/WITBOX/Configuration.h
  16. 12
    0
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  17. 12
    0
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  18. 12
    0
      Marlin/example_configurations/delta/generic/Configuration.h
  19. 12
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  20. 12
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  21. 12
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  22. 12
    0
      Marlin/example_configurations/makibox/Configuration.h
  23. 12
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  24. 39
    5
      Marlin/planner.cpp
  25. 8
    4
      Marlin/planner.h

+ 12
- 0
Marlin/Configuration.h View File

@@ -745,6 +745,11 @@
745 745
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
746 746
   #endif  // MANUAL_BED_LEVELING
747 747
 
748
+  // Gradually reduce leveling correction until a set height is reached,
749
+  // at which point movement will be level to the machine's XY plane.
750
+  // The height can be set with M420 Z<height>
751
+  #define ENABLE_LEVELING_FADE_HEIGHT
752
+
748 753
 #endif  // MESH_BED_LEVELING
749 754
 
750 755
 //===========================================================================
@@ -802,6 +807,13 @@
802 807
   // Probe along the Y axis, advancing X after each column
803 808
   //#define PROBE_Y_FIRST
804 809
 
810
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
+    // Gradually reduce leveling correction until a set height is reached,
812
+    // at which point movement will be level to the machine's XY plane.
813
+    // The height can be set with M420 Z<height>
814
+    #define ENABLE_LEVELING_FADE_HEIGHT
815
+  #endif
816
+
805 817
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
806 818
 
807 819
   // 3 arbitrary points to probe.

+ 34
- 2
Marlin/Marlin_main.cpp View File

@@ -2270,6 +2270,30 @@ static void clean_up_after_endstop_or_probe_move() {
2270 2270
     #endif
2271 2271
   }
2272 2272
 
2273
+  #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
2274
+
2275
+    void set_z_fade_height(const float zfh) {
2276
+      planner.z_fade_height = zfh;
2277
+      planner.inverse_z_fade_height = RECIPROCAL(zfh);
2278
+
2279
+      if (
2280
+        #if ENABLED(MESH_BED_LEVELING)
2281
+          mbl.active()
2282
+        #else
2283
+          planner.abl_enabled
2284
+        #endif
2285
+      ) {
2286
+        set_current_from_steppers_for_axis(
2287
+          #if ABL_PLANAR
2288
+            ALL_AXES
2289
+          #else
2290
+            Z_AXIS
2291
+          #endif
2292
+        );
2293
+      }
2294
+    }
2295
+
2296
+  #endif // LEVELING_FADE_HEIGHT
2273 2297
 
2274 2298
   /**
2275 2299
    * Reset calibration results to zero.
@@ -6788,9 +6812,17 @@ void quickstop_stepper() {
6788 6812
 
6789 6813
 #if PLANNER_LEVELING
6790 6814
   /**
6791
-   * M420: Enable/Disable Bed Leveling
6815
+   * M420: Enable/Disable Bed Leveling and/or set the Z fade height.
6816
+   *
6817
+   *       S[bool]   Turns leveling on or off
6818
+   *       Z[height] Sets the Z fade height (0 or none to disable)
6792 6819
    */
6793
-  inline void gcode_M420() { if (code_seen('S')) set_bed_leveling_enabled(code_value_bool()); }
6820
+  inline void gcode_M420() {
6821
+    if (code_seen('S')) set_bed_leveling_enabled(code_value_bool());
6822
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
6823
+      if (code_seen('Z')) set_z_fade_height(code_value_linear_units());
6824
+    #endif
6825
+  }
6794 6826
 #endif
6795 6827
 
6796 6828
 #if ENABLED(MESH_BED_LEVELING)

+ 12
- 0
Marlin/example_configurations/Cartesio/Configuration.h View File

@@ -745,6 +745,11 @@
745 745
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
746 746
   #endif  // MANUAL_BED_LEVELING
747 747
 
748
+  // Gradually reduce leveling correction until a set height is reached,
749
+  // at which point movement will be level to the machine's XY plane.
750
+  // The height can be set with M420 Z<height>
751
+  #define ENABLE_LEVELING_FADE_HEIGHT
752
+
748 753
 #endif  // MESH_BED_LEVELING
749 754
 
750 755
 //===========================================================================
@@ -802,6 +807,13 @@
802 807
   // Probe along the Y axis, advancing X after each column
803 808
   //#define PROBE_Y_FIRST
804 809
 
810
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
+    // Gradually reduce leveling correction until a set height is reached,
812
+    // at which point movement will be level to the machine's XY plane.
813
+    // The height can be set with M420 Z<height>
814
+    #define ENABLE_LEVELING_FADE_HEIGHT
815
+  #endif
816
+
805 817
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
806 818
 
807 819
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/Felix/Configuration.h View File

@@ -728,6 +728,11 @@
728 728
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
729 729
   #endif  // MANUAL_BED_LEVELING
730 730
 
731
+  // Gradually reduce leveling correction until a set height is reached,
732
+  // at which point movement will be level to the machine's XY plane.
733
+  // The height can be set with M420 Z<height>
734
+  #define ENABLE_LEVELING_FADE_HEIGHT
735
+
731 736
 #endif  // MESH_BED_LEVELING
732 737
 
733 738
 //===========================================================================
@@ -785,6 +790,13 @@
785 790
   // Probe along the Y axis, advancing X after each column
786 791
   //#define PROBE_Y_FIRST
787 792
 
793
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
794
+    // Gradually reduce leveling correction until a set height is reached,
795
+    // at which point movement will be level to the machine's XY plane.
796
+    // The height can be set with M420 Z<height>
797
+    #define ENABLE_LEVELING_FADE_HEIGHT
798
+  #endif
799
+
788 800
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
789 801
 
790 802
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/Felix/DUAL/Configuration.h View File

@@ -728,6 +728,11 @@
728 728
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
729 729
   #endif  // MANUAL_BED_LEVELING
730 730
 
731
+  // Gradually reduce leveling correction until a set height is reached,
732
+  // at which point movement will be level to the machine's XY plane.
733
+  // The height can be set with M420 Z<height>
734
+  #define ENABLE_LEVELING_FADE_HEIGHT
735
+
731 736
 #endif  // MESH_BED_LEVELING
732 737
 
733 738
 //===========================================================================
@@ -785,6 +790,13 @@
785 790
   // Probe along the Y axis, advancing X after each column
786 791
   //#define PROBE_Y_FIRST
787 792
 
793
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
794
+    // Gradually reduce leveling correction until a set height is reached,
795
+    // at which point movement will be level to the machine's XY plane.
796
+    // The height can be set with M420 Z<height>
797
+    #define ENABLE_LEVELING_FADE_HEIGHT
798
+  #endif
799
+
788 800
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
789 801
 
790 802
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -737,6 +737,11 @@
737 737
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
738 738
   #endif  // MANUAL_BED_LEVELING
739 739
 
740
+  // Gradually reduce leveling correction until a set height is reached,
741
+  // at which point movement will be level to the machine's XY plane.
742
+  // The height can be set with M420 Z<height>
743
+  #define ENABLE_LEVELING_FADE_HEIGHT
744
+
740 745
 #endif  // MESH_BED_LEVELING
741 746
 
742 747
 //===========================================================================
@@ -794,6 +799,13 @@
794 799
   // Probe along the Y axis, advancing X after each column
795 800
   //#define PROBE_Y_FIRST
796 801
 
802
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
803
+    // Gradually reduce leveling correction until a set height is reached,
804
+    // at which point movement will be level to the machine's XY plane.
805
+    // The height can be set with M420 Z<height>
806
+    #define ENABLE_LEVELING_FADE_HEIGHT
807
+  #endif
808
+
797 809
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
798 810
 
799 811
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/Hephestos_2/Configuration.h View File

@@ -739,6 +739,11 @@
739 739
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
740 740
   #endif  // MANUAL_BED_LEVELING
741 741
 
742
+  // Gradually reduce leveling correction until a set height is reached,
743
+  // at which point movement will be level to the machine's XY plane.
744
+  // The height can be set with M420 Z<height>
745
+  #define ENABLE_LEVELING_FADE_HEIGHT
746
+
742 747
 #endif  // MESH_BED_LEVELING
743 748
 
744 749
 //===========================================================================
@@ -796,6 +801,13 @@
796 801
   // Probe along the Y axis, advancing X after each column
797 802
   //#define PROBE_Y_FIRST
798 803
 
804
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
805
+    // Gradually reduce leveling correction until a set height is reached,
806
+    // at which point movement will be level to the machine's XY plane.
807
+    // The height can be set with M420 Z<height>
808
+    #define ENABLE_LEVELING_FADE_HEIGHT
809
+  #endif
810
+
799 811
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
800 812
 
801 813
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/K8200/Configuration.h View File

@@ -774,6 +774,11 @@
774 774
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
775 775
   #endif  // MANUAL_BED_LEVELING
776 776
 
777
+  // Gradually reduce leveling correction until a set height is reached,
778
+  // at which point movement will be level to the machine's XY plane.
779
+  // The height can be set with M420 Z<height>
780
+  #define ENABLE_LEVELING_FADE_HEIGHT
781
+
777 782
 #endif  // MESH_BED_LEVELING
778 783
 
779 784
 //===========================================================================
@@ -831,6 +836,13 @@
831 836
   // Probe along the Y axis, advancing X after each column
832 837
   //#define PROBE_Y_FIRST
833 838
 
839
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
840
+    // Gradually reduce leveling correction until a set height is reached,
841
+    // at which point movement will be level to the machine's XY plane.
842
+    // The height can be set with M420 Z<height>
843
+    #define ENABLE_LEVELING_FADE_HEIGHT
844
+  #endif
845
+
834 846
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
835 847
 
836 848
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/K8400/Configuration.h View File

@@ -745,6 +745,11 @@
745 745
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
746 746
   #endif  // MANUAL_BED_LEVELING
747 747
 
748
+  // Gradually reduce leveling correction until a set height is reached,
749
+  // at which point movement will be level to the machine's XY plane.
750
+  // The height can be set with M420 Z<height>
751
+  #define ENABLE_LEVELING_FADE_HEIGHT
752
+
748 753
 #endif  // MESH_BED_LEVELING
749 754
 
750 755
 //===========================================================================
@@ -802,6 +807,13 @@
802 807
   // Probe along the Y axis, advancing X after each column
803 808
   //#define PROBE_Y_FIRST
804 809
 
810
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
+    // Gradually reduce leveling correction until a set height is reached,
812
+    // at which point movement will be level to the machine's XY plane.
813
+    // The height can be set with M420 Z<height>
814
+    #define ENABLE_LEVELING_FADE_HEIGHT
815
+  #endif
816
+
805 817
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
806 818
 
807 819
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/K8400/Dual-head/Configuration.h View File

@@ -745,6 +745,11 @@
745 745
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
746 746
   #endif  // MANUAL_BED_LEVELING
747 747
 
748
+  // Gradually reduce leveling correction until a set height is reached,
749
+  // at which point movement will be level to the machine's XY plane.
750
+  // The height can be set with M420 Z<height>
751
+  #define ENABLE_LEVELING_FADE_HEIGHT
752
+
748 753
 #endif  // MESH_BED_LEVELING
749 754
 
750 755
 //===========================================================================
@@ -802,6 +807,13 @@
802 807
   // Probe along the Y axis, advancing X after each column
803 808
   //#define PROBE_Y_FIRST
804 809
 
810
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
+    // Gradually reduce leveling correction until a set height is reached,
812
+    // at which point movement will be level to the machine's XY plane.
813
+    // The height can be set with M420 Z<height>
814
+    #define ENABLE_LEVELING_FADE_HEIGHT
815
+  #endif
816
+
805 817
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
806 818
 
807 819
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

@@ -745,6 +745,11 @@
745 745
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
746 746
   #endif  // MANUAL_BED_LEVELING
747 747
 
748
+  // Gradually reduce leveling correction until a set height is reached,
749
+  // at which point movement will be level to the machine's XY plane.
750
+  // The height can be set with M420 Z<height>
751
+  #define ENABLE_LEVELING_FADE_HEIGHT
752
+
748 753
 #endif  // MESH_BED_LEVELING
749 754
 
750 755
 //===========================================================================
@@ -802,6 +807,13 @@
802 807
   // Probe along the Y axis, advancing X after each column
803 808
   //#define PROBE_Y_FIRST
804 809
 
810
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
+    // Gradually reduce leveling correction until a set height is reached,
812
+    // at which point movement will be level to the machine's XY plane.
813
+    // The height can be set with M420 Z<height>
814
+    #define ENABLE_LEVELING_FADE_HEIGHT
815
+  #endif
816
+
805 817
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
806 818
 
807 819
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/RigidBot/Configuration.h View File

@@ -743,6 +743,11 @@
743 743
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
744 744
   #endif  // MANUAL_BED_LEVELING
745 745
 
746
+  // Gradually reduce leveling correction until a set height is reached,
747
+  // at which point movement will be level to the machine's XY plane.
748
+  // The height can be set with M420 Z<height>
749
+  #define ENABLE_LEVELING_FADE_HEIGHT
750
+
746 751
 #endif  // MESH_BED_LEVELING
747 752
 
748 753
 //===========================================================================
@@ -800,6 +805,13 @@
800 805
   // Probe along the Y axis, advancing X after each column
801 806
   //#define PROBE_Y_FIRST
802 807
 
808
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
+    // Gradually reduce leveling correction until a set height is reached,
810
+    // at which point movement will be level to the machine's XY plane.
811
+    // The height can be set with M420 Z<height>
812
+    #define ENABLE_LEVELING_FADE_HEIGHT
813
+  #endif
814
+
803 815
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
804 816
 
805 817
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -760,6 +760,11 @@
760 760
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
761 761
   #endif  // MANUAL_BED_LEVELING
762 762
 
763
+  // Gradually reduce leveling correction until a set height is reached,
764
+  // at which point movement will be level to the machine's XY plane.
765
+  // The height can be set with M420 Z<height>
766
+  #define ENABLE_LEVELING_FADE_HEIGHT
767
+
763 768
 #endif  // MESH_BED_LEVELING
764 769
 
765 770
 //===========================================================================
@@ -817,6 +822,13 @@
817 822
   // Probe along the Y axis, advancing X after each column
818 823
   //#define PROBE_Y_FIRST
819 824
 
825
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
826
+    // Gradually reduce leveling correction until a set height is reached,
827
+    // at which point movement will be level to the machine's XY plane.
828
+    // The height can be set with M420 Z<height>
829
+    #define ENABLE_LEVELING_FADE_HEIGHT
830
+  #endif
831
+
820 832
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
821 833
 
822 834
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/TAZ4/Configuration.h View File

@@ -766,6 +766,11 @@
766 766
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
767 767
   #endif  // MANUAL_BED_LEVELING
768 768
 
769
+  // Gradually reduce leveling correction until a set height is reached,
770
+  // at which point movement will be level to the machine's XY plane.
771
+  // The height can be set with M420 Z<height>
772
+  #define ENABLE_LEVELING_FADE_HEIGHT
773
+
769 774
 #endif  // MESH_BED_LEVELING
770 775
 
771 776
 //===========================================================================
@@ -823,6 +828,13 @@
823 828
   // Probe along the Y axis, advancing X after each column
824 829
   //#define PROBE_Y_FIRST
825 830
 
831
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
832
+    // Gradually reduce leveling correction until a set height is reached,
833
+    // at which point movement will be level to the machine's XY plane.
834
+    // The height can be set with M420 Z<height>
835
+    #define ENABLE_LEVELING_FADE_HEIGHT
836
+  #endif
837
+
826 838
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
827 839
 
828 840
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -737,6 +737,11 @@
737 737
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
738 738
   #endif  // MANUAL_BED_LEVELING
739 739
 
740
+  // Gradually reduce leveling correction until a set height is reached,
741
+  // at which point movement will be level to the machine's XY plane.
742
+  // The height can be set with M420 Z<height>
743
+  #define ENABLE_LEVELING_FADE_HEIGHT
744
+
740 745
 #endif  // MESH_BED_LEVELING
741 746
 
742 747
 //===========================================================================
@@ -794,6 +799,13 @@
794 799
   // Probe along the Y axis, advancing X after each column
795 800
   //#define PROBE_Y_FIRST
796 801
 
802
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
803
+    // Gradually reduce leveling correction until a set height is reached,
804
+    // at which point movement will be level to the machine's XY plane.
805
+    // The height can be set with M420 Z<height>
806
+    #define ENABLE_LEVELING_FADE_HEIGHT
807
+  #endif
808
+
797 809
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
798 810
 
799 811
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

@@ -745,6 +745,11 @@
745 745
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
746 746
   #endif  // MANUAL_BED_LEVELING
747 747
 
748
+  // Gradually reduce leveling correction until a set height is reached,
749
+  // at which point movement will be level to the machine's XY plane.
750
+  // The height can be set with M420 Z<height>
751
+  #define ENABLE_LEVELING_FADE_HEIGHT
752
+
748 753
 #endif  // MESH_BED_LEVELING
749 754
 
750 755
 //===========================================================================
@@ -802,6 +807,13 @@
802 807
   // Probe along the Y axis, advancing X after each column
803 808
   //#define PROBE_Y_FIRST
804 809
 
810
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
+    // Gradually reduce leveling correction until a set height is reached,
812
+    // at which point movement will be level to the machine's XY plane.
813
+    // The height can be set with M420 Z<height>
814
+    #define ENABLE_LEVELING_FADE_HEIGHT
815
+  #endif
816
+
805 817
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
806 818
 
807 819
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

@@ -840,6 +840,11 @@
840 840
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
841 841
   #endif  // MANUAL_BED_LEVELING
842 842
 
843
+  // Gradually reduce leveling correction until a set height is reached,
844
+  // at which point movement will be level to the machine's XY plane.
845
+  // The height can be set with M420 Z<height>
846
+  #define ENABLE_LEVELING_FADE_HEIGHT
847
+
843 848
 #endif  // MESH_BED_LEVELING
844 849
 
845 850
 //===========================================================================
@@ -899,6 +904,13 @@
899 904
   // Probe along the Y axis, advancing X after each column
900 905
   //#define PROBE_Y_FIRST
901 906
 
907
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
908
+    // Gradually reduce leveling correction until a set height is reached,
909
+    // at which point movement will be level to the machine's XY plane.
910
+    // The height can be set with M420 Z<height>
911
+    #define ENABLE_LEVELING_FADE_HEIGHT
912
+  #endif
913
+
902 914
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
903 915
 
904 916
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -834,6 +834,11 @@
834 834
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
835 835
   #endif  // MANUAL_BED_LEVELING
836 836
 
837
+  // Gradually reduce leveling correction until a set height is reached,
838
+  // at which point movement will be level to the machine's XY plane.
839
+  // The height can be set with M420 Z<height>
840
+  #define ENABLE_LEVELING_FADE_HEIGHT
841
+
837 842
 #endif  // MESH_BED_LEVELING
838 843
 
839 844
 //===========================================================================
@@ -893,6 +898,13 @@
893 898
   // Probe along the Y axis, advancing X after each column
894 899
   //#define PROBE_Y_FIRST
895 900
 
901
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
902
+    // Gradually reduce leveling correction until a set height is reached,
903
+    // at which point movement will be level to the machine's XY plane.
904
+    // The height can be set with M420 Z<height>
905
+    #define ENABLE_LEVELING_FADE_HEIGHT
906
+  #endif
907
+
896 908
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
897 909
 
898 910
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -837,6 +837,11 @@
837 837
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
838 838
   #endif  // MANUAL_BED_LEVELING
839 839
 
840
+  // Gradually reduce leveling correction until a set height is reached,
841
+  // at which point movement will be level to the machine's XY plane.
842
+  // The height can be set with M420 Z<height>
843
+  #define ENABLE_LEVELING_FADE_HEIGHT
844
+
840 845
 #endif  // MESH_BED_LEVELING
841 846
 
842 847
 //===========================================================================
@@ -896,6 +901,13 @@
896 901
   // Probe along the Y axis, advancing X after each column
897 902
   //#define PROBE_Y_FIRST
898 903
 
904
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
905
+    // Gradually reduce leveling correction until a set height is reached,
906
+    // at which point movement will be level to the machine's XY plane.
907
+    // The height can be set with M420 Z<height>
908
+    #define ENABLE_LEVELING_FADE_HEIGHT
909
+  #endif
910
+
899 911
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
900 912
 
901 913
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -836,6 +836,11 @@
836 836
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
837 837
   #endif  // MANUAL_BED_LEVELING
838 838
 
839
+  // Gradually reduce leveling correction until a set height is reached,
840
+  // at which point movement will be level to the machine's XY plane.
841
+  // The height can be set with M420 Z<height>
842
+  #define ENABLE_LEVELING_FADE_HEIGHT
843
+
839 844
 #endif  // MESH_BED_LEVELING
840 845
 
841 846
 //===========================================================================
@@ -895,6 +900,13 @@
895 900
   // Probe along the Y axis, advancing X after each column
896 901
   //#define PROBE_Y_FIRST
897 902
 
903
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
904
+    // Gradually reduce leveling correction until a set height is reached,
905
+    // at which point movement will be level to the machine's XY plane.
906
+    // The height can be set with M420 Z<height>
907
+    #define ENABLE_LEVELING_FADE_HEIGHT
908
+  #endif
909
+
898 910
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
899 911
 
900 912
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -840,6 +840,11 @@
840 840
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
841 841
   #endif  // MANUAL_BED_LEVELING
842 842
 
843
+  // Gradually reduce leveling correction until a set height is reached,
844
+  // at which point movement will be level to the machine's XY plane.
845
+  // The height can be set with M420 Z<height>
846
+  #define ENABLE_LEVELING_FADE_HEIGHT
847
+
843 848
 #endif  // MESH_BED_LEVELING
844 849
 
845 850
 //===========================================================================
@@ -899,6 +904,13 @@
899 904
   // Probe along the Y axis, advancing X after each column
900 905
   //#define PROBE_Y_FIRST
901 906
 
907
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
908
+    // Gradually reduce leveling correction until a set height is reached,
909
+    // at which point movement will be level to the machine's XY plane.
910
+    // The height can be set with M420 Z<height>
911
+    #define ENABLE_LEVELING_FADE_HEIGHT
912
+  #endif
913
+
902 914
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
903 915
 
904 916
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/makibox/Configuration.h View File

@@ -748,6 +748,11 @@
748 748
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
749 749
   #endif  // MANUAL_BED_LEVELING
750 750
 
751
+  // Gradually reduce leveling correction until a set height is reached,
752
+  // at which point movement will be level to the machine's XY plane.
753
+  // The height can be set with M420 Z<height>
754
+  #define ENABLE_LEVELING_FADE_HEIGHT
755
+
751 756
 #endif  // MESH_BED_LEVELING
752 757
 
753 758
 //===========================================================================
@@ -805,6 +810,13 @@
805 810
   // Probe along the Y axis, advancing X after each column
806 811
   //#define PROBE_Y_FIRST
807 812
 
813
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
814
+    // Gradually reduce leveling correction until a set height is reached,
815
+    // at which point movement will be level to the machine's XY plane.
816
+    // The height can be set with M420 Z<height>
817
+    #define ENABLE_LEVELING_FADE_HEIGHT
818
+  #endif
819
+
808 820
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
809 821
 
810 822
   // 3 arbitrary points to probe.

+ 12
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -741,6 +741,11 @@
741 741
     #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
742 742
   #endif  // MANUAL_BED_LEVELING
743 743
 
744
+  // Gradually reduce leveling correction until a set height is reached,
745
+  // at which point movement will be level to the machine's XY plane.
746
+  // The height can be set with M420 Z<height>
747
+  #define ENABLE_LEVELING_FADE_HEIGHT
748
+
744 749
 #endif  // MESH_BED_LEVELING
745 750
 
746 751
 //===========================================================================
@@ -798,6 +803,13 @@
798 803
   // Probe along the Y axis, advancing X after each column
799 804
   //#define PROBE_Y_FIRST
800 805
 
806
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
807
+    // Gradually reduce leveling correction until a set height is reached,
808
+    // at which point movement will be level to the machine's XY plane.
809
+    // The height can be set with M420 Z<height>
810
+    #define ENABLE_LEVELING_FADE_HEIGHT
811
+  #endif
812
+
801 813
 #elif ENABLED(AUTO_BED_LEVELING_3POINT)
802 814
 
803 815
   // 3 arbitrary points to probe.

+ 39
- 5
Marlin/planner.cpp View File

@@ -104,6 +104,11 @@ float Planner::min_feedrate_mm_s,
104 104
   matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
105 105
 #endif
106 106
 
107
+#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
108
+  float Planner::z_fade_height = 0.0,
109
+        Planner::inverse_z_fade_height = 0.0;
110
+#endif
111
+
107 112
 #if ENABLED(AUTOTEMP)
108 113
   float Planner::autotemp_max = 250,
109 114
         Planner::autotemp_min = 210,
@@ -531,10 +536,24 @@ void Planner::check_axes_activity() {
531 536
       if (!abl_enabled) return;
532 537
     #endif
533 538
 
539
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
540
+      static float z_fade_factor = 1.0, last_raw_lz = -999.0;
541
+      if (z_fade_height) {
542
+        const float raw_lz = RAW_Z_POSITION(lz);
543
+        if (raw_lz >= z_fade_height) return;
544
+        if (last_raw_lz != raw_lz) {
545
+          last_raw_lz = raw_lz;
546
+          z_fade_factor = 1.0 - raw_lz * inverse_z_fade_height;
547
+        }
548
+      }
549
+      else
550
+        z_fade_factor = 1.0;
551
+    #endif
552
+
534 553
     #if ENABLED(MESH_BED_LEVELING)
535 554
 
536 555
       if (mbl.active())
537
-        lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
556
+        lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly)) * z_fade_factor;
538 557
 
539 558
     #elif ABL_PLANAR
540 559
 
@@ -551,7 +570,7 @@ void Planner::check_axes_activity() {
551 570
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
552 571
 
553 572
       float tmp[XYZ] = { lx, ly, 0 };
554
-      lz += bilinear_z_offset(tmp);
573
+      lz += bilinear_z_offset(tmp) * z_fade_factor;
555 574
 
556 575
     #endif
557 576
   }
@@ -562,10 +581,20 @@ void Planner::check_axes_activity() {
562 581
       if (!abl_enabled) return;
563 582
     #endif
564 583
 
584
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
585
+      if (z_fade_height && RAW_Z_POSITION(logical[Z_AXIS]) >= z_fade_height) return;
586
+    #endif
587
+
565 588
     #if ENABLED(MESH_BED_LEVELING)
566 589
 
567
-      if (mbl.active())
568
-        logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
590
+      if (mbl.active()) {
591
+        #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
592
+          const float c = mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
593
+          logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
594
+        #else
595
+          logical[Z_AXIS] -= mbl.get_z(RAW_X_POSITION(logical[X_AXIS]), RAW_Y_POSITION(logical[Y_AXIS]));
596
+        #endif
597
+      }
569 598
 
570 599
     #elif ABL_PLANAR
571 600
 
@@ -583,7 +612,12 @@ void Planner::check_axes_activity() {
583 612
 
584 613
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
585 614
 
586
-      logical[Z_AXIS] -= bilinear_z_offset(logical);
615
+      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
616
+        const float c = bilinear_z_offset(logical);
617
+        logical[Z_AXIS] = (z_fade_height * (RAW_Z_POSITION(logical[Z_AXIS]) - c)) / (z_fade_height - c);
618
+      #else
619
+        logical[Z_AXIS] -= bilinear_z_offset(logical);
620
+      #endif
587 621
 
588 622
     #endif
589 623
   }

+ 8
- 4
Marlin/planner.h View File

@@ -162,6 +162,10 @@ class Planner {
162 162
       static matrix_3x3 bed_level_matrix; // Transform to compensate for bed level
163 163
     #endif
164 164
 
165
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
166
+      static float z_fade_height, inverse_z_fade_height;
167
+    #endif
168
+
165 169
   private:
166 170
 
167 171
     /**
@@ -180,10 +184,10 @@ class Planner {
180 184
      */
181 185
     static float previous_nominal_speed;
182 186
 	
183
-	/**
184
- 	 * Limit where 64bit math is necessary for acceleration calculation
185
- 	 */
186
- 	static uint32_t cutoff_long;
187
+    /**
188
+     * Limit where 64bit math is necessary for acceleration calculation
189
+     */
190
+    static uint32_t cutoff_long;
187 191
 
188 192
     #if ENABLED(DISABLE_INACTIVE_EXTRUDER)
189 193
       /**

Loading…
Cancel
Save