Просмотр исходного кода

Merge pull request #6054 from thinkyhead/rc_ubl_renewal

UBL for RCBugFix — cleanup, rebase, patch
Scott Lahteine 8 лет назад
Родитель
Сommit
2c630a1b5c
53 измененных файлов: 13156 добавлений и 846 удалений
  1. 1
    1
      .gitignore
  2. 6
    0
      .travis.yml
  3. 1
    1
      Marlin/Conditionals_post.h
  4. 59
    36
      Marlin/Configuration.h
  5. 8
    1
      Marlin/Configuration_adv.h
  6. 1001
    0
      Marlin/G26_Mesh_Validation_Tool.cpp
  7. 3
    25
      Marlin/M100_Free_Mem_Chk.cpp
  8. 3
    0
      Marlin/Marlin.h
  9. 58
    14
      Marlin/Marlin_main.cpp
  10. 40
    16
      Marlin/SanityCheck.h
  11. 331
    0
      Marlin/UBL.h
  12. 296
    0
      Marlin/UBL_Bed_Leveling.cpp
  13. 1455
    0
      Marlin/UBL_G29.cpp
  14. 553
    0
      Marlin/UBL_line_to_destination.cpp
  15. 83
    1
      Marlin/configuration_store.cpp
  16. 58
    35
      Marlin/example_configurations/Cartesio/Configuration.h
  17. 22
    34
      Marlin/example_configurations/Felix/Configuration.h
  18. 58
    35
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  19. 58
    35
      Marlin/example_configurations/Hephestos/Configuration.h
  20. 59
    36
      Marlin/example_configurations/Hephestos_2/Configuration.h
  21. 58
    35
      Marlin/example_configurations/K8200/Configuration.h
  22. 58
    35
      Marlin/example_configurations/K8400/Configuration.h
  23. 58
    35
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  24. 58
    35
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  25. 59
    36
      Marlin/example_configurations/RigidBot/Configuration.h
  26. 1503
    0
      Marlin/example_configurations/Roxys_printers/Folger_Tech_i3_2020/Configuration.h
  27. 1091
    0
      Marlin/example_configurations/Roxys_printers/Folger_Tech_i3_2020/Configuration_adv.h
  28. 1500
    0
      Marlin/example_configurations/Roxys_printers/gMax_1.5+/Configuration.h
  29. 1085
    0
      Marlin/example_configurations/Roxys_printers/gMax_1.5+/Configuration_adv.h
  30. 1505
    0
      Marlin/example_configurations/Roxys_printers/original_release_files/Configuration.h
  31. 1085
    0
      Marlin/example_configurations/Roxys_printers/original_release_files/Configuration_adv.h
  32. 58
    35
      Marlin/example_configurations/SCARA/Configuration.h
  33. 58
    35
      Marlin/example_configurations/TAZ4/Configuration.h
  34. 58
    35
      Marlin/example_configurations/WITBOX/Configuration.h
  35. 58
    35
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  36. 58
    38
      Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h
  37. 58
    36
      Marlin/example_configurations/delta/generic/Configuration.h
  38. 58
    35
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  39. 59
    36
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  40. 66
    37
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  41. 58
    35
      Marlin/example_configurations/makibox/Configuration.h
  42. 58
    35
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  43. 47
    0
      Marlin/hex_print_routines.cpp
  44. 33
    0
      Marlin/hex_print_routines.h
  45. 2
    2
      Marlin/printcounter.cpp
  46. 13
    0
      Marlin/temperature.cpp
  47. 2
    1
      Marlin/temperature.h
  48. 2
    0
      Marlin/thermistornames.h
  49. 69
    0
      Marlin/thermistortable_75.h
  50. 3
    0
      Marlin/thermistortables.h
  51. 123
    3
      Marlin/ultralcd.cpp
  52. 1
    1
      Marlin/ultralcd_impl_DOGM.h
  53. 1
    1
      Marlin/ultralcd_impl_HD44780.h

+ 1
- 1
.gitignore Просмотреть файл

42
 *.i
42
 *.i
43
 *.ii
43
 *.ii
44
 *.swp
44
 *.swp
45
-
45
+tags
46
 
46
 
47
 #
47
 #
48
 # C++
48
 # C++

+ 6
- 0
.travis.yml Просмотреть файл

117
   - opt_set ABL_GRID_POINTS_Y 16
117
   - opt_set ABL_GRID_POINTS_Y 16
118
   - build_marlin
118
   - build_marlin
119
   #
119
   #
120
+  # Test a simple build of AUTO_BED_LEVELING_UBL
121
+  #
122
+  - restore_configs
123
+  - opt_enable AUTO_BED_LEVELING_UBL FIX_MOUNTED_PROBE EEPROM_SETTINGS G3D_PANEL
124
+  - build_marlin
125
+  #
120
   # Test a Sled Z Probe
126
   # Test a Sled Z Probe
121
   #
127
   #
122
   - restore_configs
128
   - restore_configs

+ 1
- 1
Marlin/Conditionals_post.h Просмотреть файл

667
    */
667
    */
668
   #define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
668
   #define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
669
   #define ABL_GRID   (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
669
   #define ABL_GRID   (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
670
-  #define HAS_ABL    (ABL_PLANAR || ABL_GRID)
670
+  #define HAS_ABL    (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
671
 
671
 
672
   #define PLANNER_LEVELING      (HAS_ABL || ENABLED(MESH_BED_LEVELING))
672
   #define PLANNER_LEVELING      (HAS_ABL || ENABLED(MESH_BED_LEVELING))
673
   #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
673
   #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))

+ 59
- 36
Marlin/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
603
 //
604
 //
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 //
606
 //
606
-// For a servo-based Z probe, you must set up servo support below, including
607
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
607
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
608
 //
608
 //
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
610
 // - Use 5V for powered (usu. inductive) sensors.
610
 // - Use 5V for powered (usu. inductive) sensors.
742
 #endif
742
 #endif
743
 
743
 
744
 //===========================================================================
744
 //===========================================================================
745
-//============================ Mesh Bed Leveling ============================
746
-//===========================================================================
747
-
748
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
749
-
750
-#if ENABLED(MESH_BED_LEVELING)
751
-  #define MESH_INSET 10        // Mesh inset margin on print area
752
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
753
-  #define MESH_NUM_Y_POINTS 3
754
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
755
-
756
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
757
-
758
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
759
-
760
-  #if ENABLED(MANUAL_BED_LEVELING)
761
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
762
-  #endif  // MANUAL_BED_LEVELING
763
-
764
-  // Gradually reduce leveling correction until a set height is reached,
765
-  // at which point movement will be level to the machine's XY plane.
766
-  // The height can be set with M420 Z<height>
767
-  #define ENABLE_LEVELING_FADE_HEIGHT
768
-
769
-#endif  // MESH_BED_LEVELING
770
-
771
-//===========================================================================
772
-//============================ Auto Bed Leveling ============================
745
+//=============================== Bed Leveling ==============================
773
 //===========================================================================
746
 //===========================================================================
774
 // @section bedlevel
747
 // @section bedlevel
775
 
748
 
793
  *   Probe several points in a grid.
766
  *   Probe several points in a grid.
794
  *   You specify the rectangle and the density of sample points.
767
  *   You specify the rectangle and the density of sample points.
795
  *   The result is a mesh, best for large or uneven beds.
768
  *   The result is a mesh, best for large or uneven beds.
769
+ *
770
+ * - UBL Unified Bed Leveling
771
+ *   A comprehensive bed leveling system that combines features and benefits from previous
772
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
773
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
774
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
775
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
776
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
777
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
778
+ *       test on.
796
  */
779
  */
797
 //#define AUTO_BED_LEVELING_3POINT
780
 //#define AUTO_BED_LEVELING_3POINT
798
 //#define AUTO_BED_LEVELING_LINEAR
781
 //#define AUTO_BED_LEVELING_LINEAR
799
 //#define AUTO_BED_LEVELING_BILINEAR
782
 //#define AUTO_BED_LEVELING_BILINEAR
783
+//#define MESH_BED_LEVELING
784
+//#define AUTO_BED_LEVELING_UBL
785
+
800
 
786
 
801
 /**
787
 /**
802
  * Enable detailed logging of G28, G29, M48, etc.
788
  * Enable detailed logging of G28, G29, M48, etc.
805
  */
791
  */
806
 //#define DEBUG_LEVELING_FEATURE
792
 //#define DEBUG_LEVELING_FEATURE
807
 
793
 
794
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
795
+  // Gradually reduce leveling correction until a set height is reached,
796
+  // at which point movement will be level to the machine's XY plane.
797
+  // The height can be set with M420 Z<height>
798
+  #define ENABLE_LEVELING_FADE_HEIGHT
799
+#endif
800
+
808
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
 
802
 
810
   // Set the number of grid points per dimension.
803
   // Set the number of grid points per dimension.
825
 
818
 
826
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
827
 
820
 
828
-    // Gradually reduce leveling correction until a set height is reached,
829
-    // at which point movement will be level to the machine's XY plane.
830
-    // The height can be set with M420 Z<height>
831
-    #define ENABLE_LEVELING_FADE_HEIGHT
832
-
833
     //
821
     //
834
     // Experimental Subdivision of the grid by Catmull-Rom method.
822
     // Experimental Subdivision of the grid by Catmull-Rom method.
835
     // Synthesizes intermediate points to produce a more detailed mesh.
823
     // Synthesizes intermediate points to produce a more detailed mesh.
853
   #define ABL_PROBE_PT_3_X 170
841
   #define ABL_PROBE_PT_3_X 170
854
   #define ABL_PROBE_PT_3_Y 20
842
   #define ABL_PROBE_PT_3_Y 20
855
 
843
 
856
-#endif
844
+#elif ENABLED(MESH_BED_LEVELING)
845
+
846
+//===========================================================================
847
+//=================================== Mesh ==================================
848
+//===========================================================================
849
+
850
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
851
+  #define MESH_INSET 10          // Mesh inset margin on print area
852
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
853
+  #define MESH_NUM_Y_POINTS 3
854
+
855
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
856
+
857
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
858
+
859
+  #if ENABLED(MANUAL_BED_LEVELING)
860
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
861
+  #endif  // MANUAL_BED_LEVELING
862
+
863
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
864
+
865
+//===========================================================================
866
+//========================= Unified Bed Leveling ============================
867
+//===========================================================================
868
+
869
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
870
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
871
+  #define UBL_MESH_NUM_Y_POINTS 10
872
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
873
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
874
+  #define UBL_PROBE_PT_2_X 39
875
+  #define UBL_PROBE_PT_2_Y 20
876
+  #define UBL_PROBE_PT_3_X 180
877
+  #define UBL_PROBE_PT_3_Y 20
878
+
879
+#endif  // BED_LEVELING
857
 
880
 
858
 /**
881
 /**
859
  * Commands to execute at the end of G29 probing.
882
  * Commands to execute at the end of G29 probing.

+ 8
- 1
Marlin/Configuration_adv.h Просмотреть файл

631
   #define MESH_MAX_Y (Y_MAX_POS - (MESH_INSET))
631
   #define MESH_MAX_Y (Y_MAX_POS - (MESH_INSET))
632
 #endif
632
 #endif
633
 
633
 
634
+#if ENABLED(AUTO_BED_LEVELING_UBL)
635
+  #define UBL_MESH_MIN_X (X_MIN_POS + UBL_MESH_INSET)
636
+  #define UBL_MESH_MAX_X (X_MAX_POS - (UBL_MESH_INSET))
637
+  #define UBL_MESH_MIN_Y (Y_MIN_POS + UBL_MESH_INSET)
638
+  #define UBL_MESH_MAX_Y (Y_MAX_POS - (UBL_MESH_INSET))
639
+#endif
640
+
634
 // @section extras
641
 // @section extras
635
 
642
 
636
 // Arc interpretation settings:
643
 // Arc interpretation settings:
1036
 #define I2C_SLAVE_ADDRESS  0 // Set a value from 8 to 127 to act as a slave
1043
 #define I2C_SLAVE_ADDRESS  0 // Set a value from 8 to 127 to act as a slave
1037
 
1044
 
1038
 /**
1045
 /**
1039
- * Add M43 command for pins info and testing
1046
+ * Add M43, M44 and M45 commands for pins info and testing
1040
  */
1047
  */
1041
 //#define PINS_DEBUGGING
1048
 //#define PINS_DEBUGGING
1042
 
1049
 

+ 1001
- 0
Marlin/G26_Mesh_Validation_Tool.cpp
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 3
- 25
Marlin/M100_Free_Mem_Chk.cpp Просмотреть файл

35
  * M100 C x Corrupts x locations within the free memory block.   This is useful to check the
35
  * M100 C x Corrupts x locations within the free memory block.   This is useful to check the
36
  *    correctness of the M100 F and M100 D commands.
36
  *    correctness of the M100 F and M100 D commands.
37
  *
37
  *
38
- * Initial version by Roxy-3DPrintBoard
38
+ * Initial version by Roxy-3D
39
  */
39
  */
40
 #define M100_FREE_MEMORY_DUMPER     // Comment out to remove Dump sub-command
40
 #define M100_FREE_MEMORY_DUMPER     // Comment out to remove Dump sub-command
41
 #define M100_FREE_MEMORY_CORRUPTOR    // Comment out to remove Corrupt sub-command
41
 #define M100_FREE_MEMORY_CORRUPTOR    // Comment out to remove Corrupt sub-command
51
 // Utility functions used by M100 to get its work done.
51
 // Utility functions used by M100 to get its work done.
52
 //
52
 //
53
 
53
 
54
+#include "hex_print_routines.h"
55
+
54
 char* top_of_stack();
56
 char* top_of_stack();
55
-void prt_hex_nibble(unsigned int);
56
-void prt_hex_byte(unsigned int);
57
-void prt_hex_word(unsigned int);
58
 int how_many_E5s_are_here(char*);
57
 int how_many_E5s_are_here(char*);
59
 
58
 
60
 void gcode_M100() {
59
 void gcode_M100() {
211
   return &x + 1; // x is pulled on return;
210
   return &x + 1; // x is pulled on return;
212
 }
211
 }
213
 
212
 
214
-//
215
-// 3 support routines to print hex numbers.  We can print a nibble, byte and word
216
-//
217
-
218
-void prt_hex_nibble(unsigned int n) {
219
-  if (n <= 9)
220
-    SERIAL_ECHO(n);
221
-  else
222
-    SERIAL_ECHO((char)('A' + n - 10));
223
-}
224
-
225
-void prt_hex_byte(unsigned int b) {
226
-  prt_hex_nibble((b & 0xf0) >> 4);
227
-  prt_hex_nibble(b & 0x0f);
228
-}
229
-
230
-void prt_hex_word(unsigned int w) {
231
-  prt_hex_byte((w & 0xff00) >> 8);
232
-  prt_hex_byte(w & 0x0ff);
233
-}
234
-
235
 // how_many_E5s_are_here() is a utility function to easily find out how many 0xE5's are
213
 // how_many_E5s_are_here() is a utility function to easily find out how many 0xE5's are
236
 // at the specified location.  Having this logic as a function simplifies the search code.
214
 // at the specified location.  Having this logic as a function simplifies the search code.
237
 //
215
 //

+ 3
- 0
Marlin/Marlin.h Просмотреть файл

40
 #include "fastio.h"
40
 #include "fastio.h"
41
 #include "utility.h"
41
 #include "utility.h"
42
 
42
 
43
+
43
 #ifdef USBCON
44
 #ifdef USBCON
44
   #include "HardwareSerial.h"
45
   #include "HardwareSerial.h"
45
   #if ENABLED(BLUETOOTH)
46
   #if ENABLED(BLUETOOTH)
82
 #define SERIAL_ECHOLNPGM(x)            SERIAL_PROTOCOLLNPGM(x)
83
 #define SERIAL_ECHOLNPGM(x)            SERIAL_PROTOCOLLNPGM(x)
83
 #define SERIAL_ECHOPAIR(name,value)    SERIAL_PROTOCOLPAIR(name, value)
84
 #define SERIAL_ECHOPAIR(name,value)    SERIAL_PROTOCOLPAIR(name, value)
84
 #define SERIAL_ECHOLNPAIR(name, value) SERIAL_PROTOCOLLNPAIR(name, value)
85
 #define SERIAL_ECHOLNPAIR(name, value) SERIAL_PROTOCOLLNPAIR(name, value)
86
+#define SERIAL_ECHO_F(x,y)             SERIAL_PROTOCOL_F(x,y)
85
 
87
 
86
 #define SERIAL_ERROR_START            (serialprintPGM(errormagic))
88
 #define SERIAL_ERROR_START            (serialprintPGM(errormagic))
87
 #define SERIAL_ERROR(x)                SERIAL_PROTOCOL(x)
89
 #define SERIAL_ERROR(x)                SERIAL_PROTOCOL(x)
95
 void serial_echopair_P(const char* s_P, long v);
97
 void serial_echopair_P(const char* s_P, long v);
96
 void serial_echopair_P(const char* s_P, float v);
98
 void serial_echopair_P(const char* s_P, float v);
97
 void serial_echopair_P(const char* s_P, double v);
99
 void serial_echopair_P(const char* s_P, double v);
100
+void serial_echopair_P(const char* s_P, unsigned int v);
98
 void serial_echopair_P(const char* s_P, unsigned long v);
101
 void serial_echopair_P(const char* s_P, unsigned long v);
99
 FORCE_INLINE void serial_echopair_P(const char* s_P, uint8_t v) { serial_echopair_P(s_P, (int)v); }
102
 FORCE_INLINE void serial_echopair_P(const char* s_P, uint8_t v) { serial_echopair_P(s_P, (int)v); }
100
 FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopair_P(s_P, (int)v); }
103
 FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopair_P(s_P, (int)v); }

+ 58
- 14
Marlin/Marlin_main.cpp Просмотреть файл

1
 /**
1
 /**
2
  * Marlin 3D Printer Firmware
2
  * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
3
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
  *
4
  *
5
  * Based on Sprinter and grbl.
5
  * Based on Sprinter and grbl.
6
  * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
6
  * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
234
 #include "duration_t.h"
234
 #include "duration_t.h"
235
 #include "types.h"
235
 #include "types.h"
236
 
236
 
237
+#if ENABLED(AUTO_BED_LEVELING_UBL)
238
+  #include "UBL.h"
239
+#endif
240
+
237
 #if HAS_ABL
241
 #if HAS_ABL
238
   #include "vector_3.h"
242
   #include "vector_3.h"
239
   #if ENABLED(AUTO_BED_LEVELING_LINEAR)
243
   #if ENABLED(AUTO_BED_LEVELING_LINEAR)
297
        G38_endstop_hit = false;
301
        G38_endstop_hit = false;
298
 #endif
302
 #endif
299
 
303
 
304
+#if ENABLED(AUTO_BED_LEVELING_UBL)
305
+  bed_leveling blm;
306
+#endif
307
+
300
 bool Running = true;
308
 bool Running = true;
301
 
309
 
302
 uint8_t marlin_debug_flags = DEBUG_NONE;
310
 uint8_t marlin_debug_flags = DEBUG_NONE;
315
  *   Set with 'gcode_get_destination' or 'set_destination_to_current'.
323
  *   Set with 'gcode_get_destination' or 'set_destination_to_current'.
316
  *   'line_to_destination' sets 'current_position' to 'destination'.
324
  *   'line_to_destination' sets 'current_position' to 'destination'.
317
  */
325
  */
318
-static float destination[XYZE] = { 0.0 };
326
+float destination[XYZE] = { 0.0 };
319
 
327
 
320
 /**
328
 /**
321
  * axis_homed
329
  * axis_homed
706
     SERIAL_ECHOPAIR("(", x);
714
     SERIAL_ECHOPAIR("(", x);
707
     SERIAL_ECHOPAIR(", ", y);
715
     SERIAL_ECHOPAIR(", ", y);
708
     SERIAL_ECHOPAIR(", ", z);
716
     SERIAL_ECHOPAIR(", ", z);
709
-    SERIAL_ECHOPGM(")");
717
+    SERIAL_CHAR(')');
710
 
718
 
711
     if (suffix) serialprintPGM(suffix);
719
     if (suffix) serialprintPGM(suffix);
712
     else SERIAL_EOL;
720
     else SERIAL_EOL;
1760
 #endif //HAS_BED_PROBE
1768
 #endif //HAS_BED_PROBE
1761
 
1769
 
1762
 #if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE)
1770
 #if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE)
1763
-  static bool axis_unhomed_error(const bool x, const bool y, const bool z) {
1771
+  bool axis_unhomed_error(const bool x, const bool y, const bool z) {
1764
     const bool xx = x && !axis_homed[X_AXIS],
1772
     const bool xx = x && !axis_homed[X_AXIS],
1765
                yy = y && !axis_homed[Y_AXIS],
1773
                yy = y && !axis_homed[Y_AXIS],
1766
                zz = z && !axis_homed[Z_AXIS];
1774
                zz = z && !axis_homed[Z_AXIS];
2009
   #endif
2017
   #endif
2010
 
2018
 
2011
   // returns false for ok and true for failure
2019
   // returns false for ok and true for failure
2012
-  static bool set_probe_deployed(bool deploy) {
2020
+  bool set_probe_deployed(bool deploy) {
2013
 
2021
 
2014
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2022
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2015
       if (DEBUGGING(LEVELING)) {
2023
       if (DEBUGGING(LEVELING)) {
2196
   //   - Raise to the BETWEEN height
2204
   //   - Raise to the BETWEEN height
2197
   // - Return the probed Z position
2205
   // - Return the probed Z position
2198
   //
2206
   //
2199
-  static float probe_pt(const float &x, const float &y, const bool stow = true, const int verbose_level = 1) {
2207
+//float probe_pt(const float &x, const float &y, const bool stow = true, const int verbose_level = 1) {
2208
+  float probe_pt(const float x, const float y, const bool stow, const int verbose_level) {
2200
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2209
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2201
       if (DEBUGGING(LEVELING)) {
2210
       if (DEBUGGING(LEVELING)) {
2202
         SERIAL_ECHOPAIR(">>> probe_pt(", x);
2211
         SERIAL_ECHOPAIR(">>> probe_pt(", x);
3291
         SERIAL_ECHOPGM("BILINEAR");
3300
         SERIAL_ECHOPGM("BILINEAR");
3292
       #elif ENABLED(AUTO_BED_LEVELING_3POINT)
3301
       #elif ENABLED(AUTO_BED_LEVELING_3POINT)
3293
         SERIAL_ECHOPGM("3POINT");
3302
         SERIAL_ECHOPGM("3POINT");
3303
+      #elif ENABLED(AUTO_BED_LEVELING_UBL)
3304
+        SERIAL_ECHOPGM("UBL");
3294
       #endif
3305
       #endif
3295
       if (planner.abl_enabled) {
3306
       if (planner.abl_enabled) {
3296
         SERIAL_ECHOLNPGM(" (enabled)");
3307
         SERIAL_ECHOLNPGM(" (enabled)");
3297
-        #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT)
3308
+        #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL)
3298
           float diff[XYZ] = {
3309
           float diff[XYZ] = {
3299
             stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
3310
             stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
3300
             stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
3311
             stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
3842
     report_current_position();
3853
     report_current_position();
3843
   }
3854
   }
3844
 
3855
 
3845
-#elif HAS_ABL
3856
+#elif HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
3846
 
3857
 
3847
   /**
3858
   /**
3848
    * G29: Detailed Z probe, probes the bed at 3 or more points.
3859
    * G29: Detailed Z probe, probes the bed at 3 or more points.
4395
       SYNC_PLAN_POSITION_KINEMATIC();
4406
       SYNC_PLAN_POSITION_KINEMATIC();
4396
   }
4407
   }
4397
 
4408
 
4398
-#endif // HAS_ABL
4409
+#endif // HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
4399
 
4410
 
4400
 #if HAS_BED_PROBE
4411
 #if HAS_BED_PROBE
4401
 
4412
 
7005
             bed_level_virt_print();
7016
             bed_level_virt_print();
7006
           #endif
7017
           #endif
7007
         }
7018
         }
7019
+      #elif ENABLED(AUTO_BED_LEVELING_UBL)
7020
+        blm.display_map(0);  // Right now, we only support one type of map
7008
       #elif ENABLED(MESH_BED_LEVELING)
7021
       #elif ENABLED(MESH_BED_LEVELING)
7009
         if (mbl.has_mesh()) {
7022
         if (mbl.has_mesh()) {
7010
           SERIAL_ECHOLNPGM("Mesh Bed Level data:");
7023
           SERIAL_ECHOLNPGM("Mesh Bed Level data:");
8315
           break;
8328
           break;
8316
       #endif // INCH_MODE_SUPPORT
8329
       #endif // INCH_MODE_SUPPORT
8317
 
8330
 
8331
+      #if ENABLED(AUTO_BED_LEVELING_UBL)
8332
+        case 26: // G26: Mesh Validation Pattern generation
8333
+          gcode_G26();
8334
+          break;
8335
+      #endif // AUTO_BED_LEVELING_UBL
8336
+
8318
       #if ENABLED(NOZZLE_PARK_FEATURE)
8337
       #if ENABLED(NOZZLE_PARK_FEATURE)
8319
         case 27: // G27: Nozzle Park
8338
         case 27: // G27: Nozzle Park
8320
           gcode_G27();
8339
           gcode_G27();
8326
         break;
8345
         break;
8327
 
8346
 
8328
       #if PLANNER_LEVELING
8347
       #if PLANNER_LEVELING
8329
-        case 29: // G29 Detailed Z probe, probes the bed at 3 or more points.
8348
+        case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
8349
+                 // or provides access to the UBL System if enabled.
8330
           gcode_G29();
8350
           gcode_G29();
8331
           break;
8351
           break;
8332
       #endif // PLANNER_LEVELING
8352
       #endif // PLANNER_LEVELING
8433
           gcode_M43(); break;
8453
           gcode_M43(); break;
8434
       #endif
8454
       #endif
8435
 
8455
 
8456
+
8436
       #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
8457
       #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
8437
         case 48: // M48: Z probe repeatability test
8458
         case 48: // M48: Z probe repeatability test
8438
           gcode_M48();
8459
           gcode_M48();
8439
           break;
8460
           break;
8440
       #endif // Z_MIN_PROBE_REPEATABILITY_TEST
8461
       #endif // Z_MIN_PROBE_REPEATABILITY_TEST
8441
 
8462
 
8463
+      #if ENABLED(AUTO_BED_LEVELING_UBL)
8464
+        case 49: // M49: Turn on or off G26_Debug_flag for verbose output
8465
+    if (G26_Debug_flag) {
8466
+            SERIAL_PROTOCOLPGM("UBL Debug Flag turned off.\n");
8467
+            G26_Debug_flag = 0; }
8468
+    else {
8469
+            SERIAL_PROTOCOLPGM("UBL Debug Flag turned on.\n");
8470
+            G26_Debug_flag++; }
8471
+          break;
8472
+      #endif // Z_MIN_PROBE_REPEATABILITY_TEST
8473
+
8442
       case 75: // M75: Start print timer
8474
       case 75: // M75: Start print timer
8443
         gcode_M75(); break;
8475
         gcode_M75(); break;
8444
       case 76: // M76: Pause print timer
8476
       case 76: // M76: Pause print timer
9078
       SERIAL_ECHOLNPAIR(" offset=", offset);
9110
       SERIAL_ECHOLNPAIR(" offset=", offset);
9079
     }
9111
     }
9080
     last_offset = offset;
9112
     last_offset = offset;
9081
-    //*/
9113
+    */
9082
 
9114
 
9083
     return offset;
9115
     return offset;
9084
   }
9116
   }
9564
           return false;
9596
           return false;
9565
         }
9597
         }
9566
         else
9598
         else
9599
+      #elif ENABLED(AUTO_BED_LEVELING_UBL)
9600
+        if (blm.state.active) {
9601
+
9602
+//        UBL_line_to_destination(MMS_SCALED(feedrate_mm_s));
9603
+
9604
+          UBL_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
9605
+//                      (feedrate*(1.0/60.0))*(feedrate_percentage*(1.0/100.0) ), active_extruder);
9606
+                      MMS_SCALED(feedrate_mm_s), active_extruder);
9607
+
9608
+          return false;
9609
+        }
9610
+        else
9567
       #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
9611
       #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
9568
         if (planner.abl_enabled) {
9612
         if (planner.abl_enabled) {
9569
           bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s));
9613
           bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s));
10565
   #endif
10609
   #endif
10566
 
10610
 
10567
   #if ENABLED(RGB_LED)
10611
   #if ENABLED(RGB_LED)
10568
-    pinMode(RGB_LED_R_PIN, OUTPUT);
10569
-    pinMode(RGB_LED_G_PIN, OUTPUT);
10570
-    pinMode(RGB_LED_B_PIN, OUTPUT);
10612
+    SET_OUTPUT(RGB_LED_R_PIN);
10613
+    SET_OUTPUT(RGB_LED_G_PIN);
10614
+    SET_OUTPUT(RGB_LED_B_PIN);
10571
   #endif
10615
   #endif
10572
 
10616
 
10573
   lcd_init();
10617
   lcd_init();

+ 40
- 16
Marlin/SanityCheck.h Просмотреть файл

388
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
388
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
389
     + 1
389
     + 1
390
   #endif
390
   #endif
391
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
392
+    + 1
393
+  #endif
391
   #if ENABLED(MESH_BED_LEVELING)
394
   #if ENABLED(MESH_BED_LEVELING)
392
     + 1
395
     + 1
393
   #endif
396
   #endif
394
-  , "Select only one of: MESH_BED_LEVELING, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, or AUTO_BED_LEVELING_BILINEAR."
397
+  , "Select only one of: MESH_BED_LEVELING, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
395
 );
398
 );
396
 
399
 
397
 /**
400
 /**
403
   #elif MESH_NUM_X_POINTS > 9 || MESH_NUM_Y_POINTS > 9
406
   #elif MESH_NUM_X_POINTS > 9 || MESH_NUM_Y_POINTS > 9
404
     #error "MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS must be less than 10."
407
     #error "MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS must be less than 10."
405
   #endif
408
   #endif
409
+#elif ENABLED(MANUAL_BED_LEVELING)
410
+  #error "MANUAL_BED_LEVELING only applies to MESH_BED_LEVELING."
411
+#endif
412
+
413
+/**
414
+ * Unified Bed Leveling
415
+ */
416
+#if ENABLED(AUTO_BED_LEVELING_UBL)
417
+  #if ENABLED(DELTA)
418
+    #error "AUTO_BED_LEVELING_UBL does not yet support DELTA printers."
419
+  #elif DISABLED(NEWPANEL)
420
+    #error "AUTO_BED_LEVELING_UBL requires an LCD controller."
421
+  #elif UBL_MESH_NUM_X_POINTS > 15 || UBL_MESH_NUM_Y_POINTS > 15
422
+    #error "UBL_MESH_NUM_X_POINTS and UBL_MESH_NUM_Y_POINTS must be less than 16."
423
+  #endif
406
 #endif
424
 #endif
407
 
425
 
408
 /**
426
 /**
434
   , "Please enable only one probe: PROBE_MANUALLY, FIX_MOUNTED_PROBE, Z Servo, BLTOUCH, Z_PROBE_ALLEN_KEY, or Z_PROBE_SLED."
452
   , "Please enable only one probe: PROBE_MANUALLY, FIX_MOUNTED_PROBE, Z Servo, BLTOUCH, Z_PROBE_ALLEN_KEY, or Z_PROBE_SLED."
435
 );
453
 );
436
 
454
 
455
+
437
 #if PROBE_SELECTED
456
 #if PROBE_SELECTED
438
 
457
 
439
   /**
458
   /**
577
       #endif
596
       #endif
578
     #endif
597
     #endif
579
   #else // !ABL_GRID
598
   #else // !ABL_GRID
580
-
581
-    // Check the triangulation points
582
-    #if ABL_PROBE_PT_1_X < MIN_PROBE_X || ABL_PROBE_PT_1_X > MAX_PROBE_X
583
-      #error "The given ABL_PROBE_PT_1_X can't be reached by the Z probe."
584
-    #elif ABL_PROBE_PT_2_X < MIN_PROBE_X || ABL_PROBE_PT_2_X > MAX_PROBE_X
585
-      #error "The given ABL_PROBE_PT_2_X can't be reached by the Z probe."
586
-    #elif ABL_PROBE_PT_3_X < MIN_PROBE_X || ABL_PROBE_PT_3_X > MAX_PROBE_X
587
-      #error "The given ABL_PROBE_PT_3_X can't be reached by the Z probe."
588
-    #elif ABL_PROBE_PT_1_Y < MIN_PROBE_Y || ABL_PROBE_PT_1_Y > MAX_PROBE_Y
589
-      #error "The given ABL_PROBE_PT_1_Y can't be reached by the Z probe."
590
-    #elif ABL_PROBE_PT_2_Y < MIN_PROBE_Y || ABL_PROBE_PT_2_Y > MAX_PROBE_Y
591
-      #error "The given ABL_PROBE_PT_2_Y can't be reached by the Z probe."
592
-    #elif ABL_PROBE_PT_3_Y < MIN_PROBE_Y || ABL_PROBE_PT_3_Y > MAX_PROBE_Y
593
-      #error "The given ABL_PROBE_PT_3_Y can't be reached by the Z probe."
594
-    #endif
599
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
600
+      #ifndef EEPROM_SETTINGS
601
+        #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS. Please update your configuration."
602
+      #endif
603
+    #else // !UBL
604
+      // Check the triangulation points
605
+      #if ABL_PROBE_PT_1_X < MIN_PROBE_X || ABL_PROBE_PT_1_X > MAX_PROBE_X
606
+        #error "The given ABL_PROBE_PT_1_X can't be reached by the Z probe."
607
+      #elif ABL_PROBE_PT_2_X < MIN_PROBE_X || ABL_PROBE_PT_2_X > MAX_PROBE_X
608
+        #error "The given ABL_PROBE_PT_2_X can't be reached by the Z probe."
609
+      #elif ABL_PROBE_PT_3_X < MIN_PROBE_X || ABL_PROBE_PT_3_X > MAX_PROBE_X
610
+        #error "The given ABL_PROBE_PT_3_X can't be reached by the Z probe."
611
+      #elif ABL_PROBE_PT_1_Y < MIN_PROBE_Y || ABL_PROBE_PT_1_Y > MAX_PROBE_Y
612
+        #error "The given ABL_PROBE_PT_1_Y can't be reached by the Z probe."
613
+      #elif ABL_PROBE_PT_2_Y < MIN_PROBE_Y || ABL_PROBE_PT_2_Y > MAX_PROBE_Y
614
+        #error "The given ABL_PROBE_PT_2_Y can't be reached by the Z probe."
615
+      #elif ABL_PROBE_PT_3_Y < MIN_PROBE_Y || ABL_PROBE_PT_3_Y > MAX_PROBE_Y
616
+        #error "The given ABL_PROBE_PT_3_Y can't be reached by the Z probe."
617
+      #endif
618
+    #endif // !AUTO_BED_LEVEING_UBL
595
 
619
 
596
   #endif // !ABL_GRID
620
   #endif // !ABL_GRID
597
 
621
 

+ 331
- 0
Marlin/UBL.h Просмотреть файл

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "Marlin.h"
24
+#include "math.h"
25
+
26
+#ifndef UNIFIED_BED_LEVELING_H
27
+#define UNIFIED_BED_LEVELING_H
28
+
29
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
30
+
31
+    #define UBL_OK false
32
+    #define UBL_ERR true
33
+
34
+    typedef struct {
35
+      int x_index, y_index;
36
+      float distance; // Not always used. But when populated, it is the distance
37
+                      // from the search location
38
+    } mesh_index_pair;
39
+
40
+    struct vector { double dx, dy, dz; };
41
+
42
+    enum Mesh_Point_Type { INVALID, REAL, SET_IN_BITMAP };
43
+
44
+    bool axis_unhomed_error(bool, bool, bool);
45
+    void dump(char *str, float f);
46
+    bool G29_lcd_clicked();
47
+    void probe_entire_mesh(float, float, bool, bool);
48
+    void UBL_line_to_destination(const float&, const float&, const float&, const float&, const float&, uint8_t);
49
+    void manually_probe_remaining_mesh(float, float, float, float, bool);
50
+    struct vector tilt_mesh_based_on_3pts(float, float, float);
51
+    void new_set_bed_level_equation_3pts(float, float, float);
52
+    float measure_business_card_thickness(float);
53
+    mesh_index_pair find_closest_mesh_point_of_type(Mesh_Point_Type, float, float, bool, unsigned int[16]);
54
+    void Find_Mean_Mesh_Height();
55
+    void Shift_Mesh_Height();
56
+    bool G29_Parameter_Parsing();
57
+    void G29_What_Command();
58
+    void G29_EEPROM_Dump();
59
+    void G29_Kompare_Current_Mesh_to_Stored_Mesh();
60
+    void fine_tune_mesh(float, float, float, bool);
61
+    void bit_clear(uint16_t bits[16], uint8_t x, uint8_t y);
62
+    void bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
63
+    bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
64
+    char *ftostr43sign(const float&, char);
65
+
66
+    void gcode_G26();
67
+    void gcode_G28();
68
+    void gcode_G29();
69
+    extern char conv[9];
70
+
71
+    void save_UBL_active_state_and_disable();
72
+    void restore_UBL_active_state_and_leave();
73
+
74
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////
75
+
76
+    #if ENABLED(ULTRA_LCD)
77
+      extern char lcd_status_message[];
78
+      void lcd_quick_feedback();
79
+    #endif
80
+
81
+    enum MBLStatus { MBL_STATUS_NONE = 0, MBL_STATUS_HAS_MESH_BIT = 0, MBL_STATUS_ACTIVE_BIT = 1 };
82
+
83
+    #define MESH_X_DIST ((float(UBL_MESH_MAX_X) - float(UBL_MESH_MIN_X)) / (float(UBL_MESH_NUM_X_POINTS) - 1.0))
84
+    #define MESH_Y_DIST ((float(UBL_MESH_MAX_Y) - float(UBL_MESH_MIN_Y)) / (float(UBL_MESH_NUM_Y_POINTS) - 1.0))
85
+
86
+    extern bool G26_Debug_flag;
87
+    extern float last_specified_z;
88
+    extern float fade_scaling_factor_for_current_height;
89
+    extern float z_values[UBL_MESH_NUM_X_POINTS][UBL_MESH_NUM_Y_POINTS];
90
+    extern float mesh_index_to_X_location[UBL_MESH_NUM_X_POINTS + 1]; // +1 just because of paranoia that we might end up on the
91
+    extern float mesh_index_to_Y_location[UBL_MESH_NUM_Y_POINTS + 1]; // the last Mesh Line and that is the start of a whole new cell
92
+
93
+    class bed_leveling {
94
+      public:
95
+      struct ubl_state {
96
+        bool active = false;
97
+        float z_offset = 0.0;
98
+        int EEPROM_storage_slot = -1,
99
+            n_x = UBL_MESH_NUM_X_POINTS,
100
+            n_y = UBL_MESH_NUM_Y_POINTS;
101
+        float mesh_x_min = UBL_MESH_MIN_X,
102
+              mesh_y_min = UBL_MESH_MIN_Y,
103
+              mesh_x_max = UBL_MESH_MAX_X,
104
+              mesh_y_max = UBL_MESH_MAX_Y,
105
+              mesh_x_dist = MESH_X_DIST,
106
+              mesh_y_dist = MESH_Y_DIST,
107
+              G29_Correction_Fade_Height = 10.0,
108
+              G29_Fade_Height_Multiplier = 1.0 / 10.0; // It is cheaper to do a floating point multiply than a floating
109
+                                                       // point divide. So, we keep this number in both forms. The first
110
+                                                       // is for the user. The second one is the one that is actually used
111
+                                                       // again and again and again during the correction calculations.
112
+
113
+        unsigned char padding[24];  // This is just to allow room to add state variables without
114
+                                    // changing the location of data structures in the EEPROM.
115
+                                    // This is for compatability with future versions to keep
116
+                                    // people from having to regenerate thier mesh data.
117
+                                    //
118
+                                    // If you change the contents of this struct, please adjust
119
+                                    // the padding[] to keep the size the same!
120
+      } state, pre_initialized;
121
+
122
+      bed_leveling();
123
+      //  ~bed_leveling();  // No destructor because this object never goes away!
124
+
125
+      void display_map(int);
126
+
127
+      void reset();
128
+      void invalidate();
129
+
130
+      void store_state();
131
+      void load_state();
132
+      void store_mesh(int);
133
+      void load_mesh(int);
134
+
135
+      bool sanity_check();
136
+
137
+      FORCE_INLINE float map_x_index_to_bed_location(int8_t i){ return ((float) UBL_MESH_MIN_X) + (((float) MESH_X_DIST) * (float) i); };
138
+      FORCE_INLINE float map_y_index_to_bed_location(int8_t i){ return ((float) UBL_MESH_MIN_Y) + (((float) MESH_Y_DIST) * (float) i); };
139
+
140
+      void set_z(const int8_t px, const int8_t py, const float z) { z_values[px][py] = z; }
141
+
142
+      int8_t get_cell_index_x(float x) {
143
+        int8_t cx = (x - (UBL_MESH_MIN_X)) * (1.0 / (MESH_X_DIST));
144
+        return constrain(cx, 0, (UBL_MESH_NUM_X_POINTS) - 1);   // -1 is appropriate if we want all movement to the X_MAX
145
+      }                                                         // position. But with this defined this way, it is possible
146
+                                                                // to extrapolate off of this point even further out. Probably
147
+                                                                // that is OK because something else should be keeping that from
148
+                                                                // happening and should not be worried about at this level.
149
+      int8_t get_cell_index_y(float y) {
150
+        int8_t cy = (y - (UBL_MESH_MIN_Y)) * (1.0 / (MESH_Y_DIST));
151
+        return constrain(cy, 0, (UBL_MESH_NUM_Y_POINTS) - 1);   // -1 is appropriate if we want all movement to the Y_MAX
152
+      }                                                         // position. But with this defined this way, it is possible
153
+                                                                // to extrapolate off of this point even further out. Probably
154
+                                                                // that is OK because something else should be keeping that from
155
+                                                                // happening and should not be worried about at this level.
156
+
157
+      int8_t find_closest_x_index(float x) {
158
+        int8_t px = (x - (UBL_MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
159
+        return (px >= 0 && px < (UBL_MESH_NUM_X_POINTS)) ? px : -1;
160
+      }
161
+
162
+      int8_t find_closest_y_index(float y) {
163
+        int8_t py = (y - (UBL_MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST));
164
+        return (py >= 0 && py < (UBL_MESH_NUM_Y_POINTS)) ? py : -1;
165
+      }
166
+
167
+      /**
168
+       *                           z2   --|
169
+       *                 z0        |      |
170
+       *                  |        |      + (z2-z1)
171
+       *   z1             |        |      |
172
+       * ---+-------------+--------+--  --|
173
+       *   a1            a0        a2
174
+       *    |<---delta_a---------->|
175
+       *
176
+       *  calc_z0 is the basis for all the Mesh Based correction. It is used to
177
+       *  find the expected Z Height at a position between two known Z-Height locations
178
+       *
179
+       *  It is farly expensive with its 4 floating point additions and 2 floating point
180
+       *  multiplications.
181
+       */
182
+      inline float calc_z0(float a0, float a1, float z1, float a2, float z2) {
183
+        float delta_z = (z2 - z1);
184
+        float delta_a = (a0 - a1) / (a2 - a1);
185
+        return z1 + delta_a * delta_z;
186
+      }
187
+
188
+      /**
189
+       * get_z_correction_at_Y_intercept(float x0, int x1_i, int yi) only takes
190
+       * three parameters. It assumes the x0 point is on a Mesh line denoted by yi. In theory
191
+       * we could use get_cell_index_x(float x) to obtain the 2nd parameter x1_i but any code calling
192
+       * the get_z_correction_along_vertical_mesh_line_at_specific_X routine  will already have
193
+       * the X index of the x0 intersection available and we don't want to perform any extra floating
194
+       * point operations.
195
+       */
196
+      inline float get_z_correction_along_horizontal_mesh_line_at_specific_X(float x0, int x1_i, int yi) {
197
+        if (x1_i < 0 || yi < 0 || x1_i >= UBL_MESH_NUM_X_POINTS || yi >= UBL_MESH_NUM_Y_POINTS) {
198
+          SERIAL_ECHOPAIR("? in get_z_correction_along_horizontal_mesh_line_at_specific_X(x0=", x0);
199
+          SERIAL_ECHOPAIR(",x1_i=", x1_i);
200
+          SERIAL_ECHOPAIR(",yi=", yi);
201
+          SERIAL_CHAR(')');
202
+          SERIAL_EOL;
203
+          return NAN;
204
+        }
205
+
206
+        const float a0ma1diva2ma1 = (x0 - mesh_index_to_X_location[x1_i]) * (1.0 / (MESH_X_DIST)),
207
+                    z1 = z_values[x1_i][yi],
208
+                    z2 = z_values[x1_i + 1][yi],
209
+                    dz = (z2 - z1);
210
+
211
+        return z1 + a0ma1diva2ma1 * dz;
212
+      }
213
+
214
+      //
215
+      // See comments above for get_z_correction_along_horizontal_mesh_line_at_specific_X
216
+      //
217
+      inline float get_z_correction_along_vertical_mesh_line_at_specific_Y(float y0, int xi, int y1_i) {
218
+        if (xi < 0 || y1_i < 0 || xi >= UBL_MESH_NUM_X_POINTS || y1_i >= UBL_MESH_NUM_Y_POINTS) {
219
+          SERIAL_ECHOPAIR("? in get_z_correction_along_vertical_mesh_line_at_specific_X(y0=", y0);
220
+          SERIAL_ECHOPAIR(", x1_i=", xi);
221
+          SERIAL_ECHOPAIR(", yi=", y1_i);
222
+          SERIAL_CHAR(')');
223
+          SERIAL_EOL;
224
+          return NAN;
225
+        }
226
+
227
+        const float a0ma1diva2ma1 = (y0 - mesh_index_to_Y_location[y1_i]) * (1.0 / (MESH_Y_DIST)),
228
+                    z1 = z_values[xi][y1_i],
229
+                    z2 = z_values[xi][y1_i + 1],
230
+                    dz = (z2 - z1);
231
+
232
+        return z1 + a0ma1diva2ma1 * dz;
233
+      }
234
+
235
+      /**
236
+       * This is the generic Z-Correction. It works anywhere within a Mesh Cell. It first
237
+       * does a linear interpolation along both of the bounding X-Mesh-Lines to find the
238
+       * Z-Height at both ends. Then it does a linear interpolation of these heights based
239
+       * on the Y position within the cell.
240
+       */
241
+      float get_z_correction(float x0, float y0) {
242
+        int8_t cx = get_cell_index_x(x0),
243
+        cy = get_cell_index_y(y0);
244
+
245
+        if (cx < 0 || cy < 0 || cx >= UBL_MESH_NUM_X_POINTS || cy >= UBL_MESH_NUM_Y_POINTS) {
246
+
247
+          SERIAL_ECHOPAIR("? in get_z_correction(x0=", x0);
248
+          SERIAL_ECHOPAIR(", y0=", y0);
249
+          SERIAL_CHAR(')');
250
+          SERIAL_EOL;
251
+
252
+          #if ENABLED(ULTRA_LCD)
253
+            strcpy(lcd_status_message, "get_z_correction() indexes out of range.");
254
+            lcd_quick_feedback();
255
+          #endif
256
+          return 0.0; // this used to return state.z_offset
257
+        }
258
+
259
+        float z1 = calc_z0(x0,
260
+          map_x_index_to_bed_location(cx), z_values[cx][cy],
261
+          map_x_index_to_bed_location(cx + 1), z_values[cx + 1][cy]);
262
+        float z2 = calc_z0(x0,
263
+          map_x_index_to_bed_location(cx), z_values[cx][cy + 1],
264
+          map_x_index_to_bed_location(cx + 1), z_values[cx + 1][cy + 1]);
265
+        float z0 = calc_z0(y0,
266
+          map_y_index_to_bed_location(cy), z1,
267
+          map_y_index_to_bed_location(cy + 1), z2);
268
+
269
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
270
+          if (DEBUGGING(MESH_ADJUST)) {
271
+            SERIAL_ECHOPAIR(" raw get_z_correction(", x0);
272
+            SERIAL_ECHOPAIR(",", y0);
273
+            SERIAL_ECHOPGM(")=");
274
+            SERIAL_PROTOCOL_F(z0, 6);
275
+          }
276
+        #endif
277
+
278
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
279
+          if (DEBUGGING(MESH_ADJUST)) {
280
+            SERIAL_ECHOPGM(" >>>---> ");
281
+            SERIAL_PROTOCOL_F(z0, 6);
282
+            SERIAL_EOL;
283
+          }
284
+        #endif
285
+
286
+        if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN
287
+          z0 = 0.0;      // in blm.z_values[][] and propagate through the
288
+                         // calculations. If our correction is NAN, we throw it out
289
+                         // because part of the Mesh is undefined and we don't have the
290
+                         // information we need to complete the height correction.
291
+
292
+          #if ENABLED(DEBUG_LEVELING_FEATURE)
293
+            if (DEBUGGING(MESH_ADJUST)) {
294
+              SERIAL_ECHOPGM("??? Yikes!  NAN in get_z_correction( ");
295
+              SERIAL_ECHO(x0);
296
+              SERIAL_ECHOPGM(", ");
297
+              SERIAL_ECHO(y0);
298
+              SERIAL_ECHOLNPGM(" )");
299
+            }
300
+          #endif
301
+        }
302
+        return z0; // there used to be a +state.z_offset on this line
303
+      }
304
+
305
+      /**
306
+       * This routine is used to scale the Z correction depending upon the current nozzle height. It is
307
+       * optimized for speed. It avoids floating point operations by checking if the requested scaling
308
+       * factor is going to be the same as the last time the function calculated a value. If so, it just
309
+       * returns it.
310
+       *
311
+       * If it must do a calcuation, it will return a scaling factor of 0.0 if the UBL System is not active
312
+       * or if the current Z Height is past the specified 'Fade Height'
313
+       */
314
+      FORCE_INLINE float fade_scaling_factor_for_Z(float current_z) {
315
+        if (last_specified_z == current_z)
316
+          return fade_scaling_factor_for_current_height;
317
+
318
+        last_specified_z = current_z;
319
+        fade_scaling_factor_for_current_height =
320
+          state.active && current_z < state.G29_Correction_Fade_Height
321
+          ? 1.0 - (current_z * state.G29_Fade_Height_Multiplier)
322
+          : 0.0;
323
+        return fade_scaling_factor_for_current_height;
324
+      }
325
+    };
326
+
327
+    extern bed_leveling blm;
328
+    extern int Unified_Bed_Leveling_EEPROM_start;
329
+
330
+#endif // AUTO_BED_LEVELING_UBL
331
+#endif // UNIFIED_BED_LEVELING_H

+ 296
- 0
Marlin/UBL_Bed_Leveling.cpp Просмотреть файл

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "Marlin.h"
24
+#include "math.h"
25
+
26
+#if ENABLED(AUTO_BED_LEVELING_UBL)
27
+  #include "UBL.h"
28
+  #include "hex_print_routines.h"
29
+
30
+  /**
31
+   * These variables used to be declared inside the bed_leveling class.  We are going to still declare
32
+   * them within the .cpp file for bed leveling.   But there is only one instance of the bed leveling
33
+   * object and we can get rid of a level of inderection by not making them 'member data'.  So, in the
34
+   * interest of speed, we do it this way.    When we move to a 32-Bit processor, they can be moved
35
+   * back inside the bed leveling class.
36
+   */
37
+  float last_specified_z,
38
+        fade_scaling_factor_for_current_height,
39
+        z_values[UBL_MESH_NUM_X_POINTS][UBL_MESH_NUM_Y_POINTS],
40
+        mesh_index_to_X_location[UBL_MESH_NUM_X_POINTS + 1], // +1 just because of paranoia that we might end up on the
41
+        mesh_index_to_Y_location[UBL_MESH_NUM_Y_POINTS + 1]; // the last Mesh Line and that is the start of a whole new cell
42
+
43
+  bed_leveling::bed_leveling() {
44
+    for (uint8_t i = 0; i <= UBL_MESH_NUM_X_POINTS; i++)  // We go one past what we expect to ever need for safety
45
+      mesh_index_to_X_location[i] = double(UBL_MESH_MIN_X) + double(MESH_X_DIST) * double(i);
46
+
47
+    for (uint8_t i = 0; i <= UBL_MESH_NUM_Y_POINTS; i++)  // We go one past what we expect to ever need for safety
48
+      mesh_index_to_Y_location[i] = double(UBL_MESH_MIN_Y) + double(MESH_Y_DIST) * double(i);
49
+
50
+    reset();
51
+  }
52
+
53
+  void bed_leveling::store_state() {
54
+    int k = E2END - sizeof(blm.state);
55
+    eeprom_write_block((void *)&blm.state, (void *)k, sizeof(blm.state));
56
+  }
57
+
58
+  void bed_leveling::load_state() {
59
+    int k = E2END - sizeof(blm.state);
60
+    eeprom_read_block((void *)&blm.state, (void *)k, sizeof(blm.state));
61
+
62
+    if (sanity_check())
63
+      SERIAL_PROTOCOLLNPGM("?In load_state() sanity_check() failed.\n");
64
+
65
+    // These lines can go away in a few weeks.  They are just
66
+    // to make sure people updating thier firmware won't be using
67
+    if (blm.state.G29_Fade_Height_Multiplier != 1.0 / blm.state.G29_Correction_Fade_Height) { // an incomplete Bed_Leveling.state structure. For speed
68
+      blm.state.G29_Fade_Height_Multiplier = 1.0 / blm.state.G29_Correction_Fade_Height;      // we now multiply by the inverse of the Fade Height instead of
69
+      store_state();   // dividing by it. Soon... all of the old structures will be
70
+    }                  // updated, but until then, we try to ease the transition
71
+                       // for our Beta testers.
72
+  }
73
+
74
+  void bed_leveling::load_mesh(int m) {
75
+    int k = E2END - sizeof(blm.state),
76
+        j = (k - Unified_Bed_Leveling_EEPROM_start) / sizeof(z_values);
77
+
78
+    if (m == -1) {
79
+      SERIAL_PROTOCOLLNPGM("?No mesh saved in EEPROM. Zeroing mesh in memory.\n");
80
+      reset();
81
+      return;
82
+    }
83
+
84
+    if (m < 0 || m >= j || Unified_Bed_Leveling_EEPROM_start <= 0) {
85
+      SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
86
+      return;
87
+    }
88
+
89
+    j = k - (m + 1) * sizeof(z_values);
90
+    eeprom_read_block((void *)&z_values , (void *)j, sizeof(z_values));
91
+
92
+    SERIAL_PROTOCOLPGM("Mesh loaded from slot ");
93
+    SERIAL_PROTOCOL(m);
94
+    SERIAL_PROTOCOLPGM("  at offset 0x");
95
+    prt_hex_word(j);
96
+    SERIAL_EOL;
97
+  }
98
+
99
+  void bed_leveling:: store_mesh(int m) {
100
+    int k = E2END - sizeof(state),
101
+        j = (k - Unified_Bed_Leveling_EEPROM_start) / sizeof(z_values);
102
+
103
+    if (m < 0 || m >= j || Unified_Bed_Leveling_EEPROM_start <= 0) {
104
+      SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
105
+      SERIAL_PROTOCOL(m);
106
+      SERIAL_PROTOCOLLNPGM(" mesh slots available.\n");
107
+      SERIAL_PROTOCOLLNPAIR("E2END     : ", E2END);
108
+      SERIAL_PROTOCOLLNPAIR("k         : ", k);
109
+      SERIAL_PROTOCOLLNPAIR("j         : ", j);
110
+      SERIAL_PROTOCOLLNPAIR("m         : ", m);
111
+      SERIAL_EOL;
112
+      return;
113
+    }
114
+
115
+    j = k - (m + 1) * sizeof(z_values);
116
+    eeprom_write_block((const void *)&z_values, (void *)j, sizeof(z_values));
117
+
118
+    SERIAL_PROTOCOLPGM("Mesh saved in slot ");
119
+    SERIAL_PROTOCOL(m);
120
+    SERIAL_PROTOCOLPGM("  at offset 0x");
121
+    prt_hex_word(j);
122
+    SERIAL_EOL;
123
+  }
124
+
125
+  void bed_leveling::reset() {
126
+    state.active = false;
127
+    state.z_offset = 0;
128
+    state.EEPROM_storage_slot = -1;
129
+
130
+    ZERO(z_values);
131
+
132
+    last_specified_z = -999.9;        // We can't pre-initialize these values in the declaration
133
+    fade_scaling_factor_for_current_height = 0.0; // due to C++11 constraints
134
+  }
135
+
136
+  void bed_leveling::invalidate() {
137
+    prt_hex_word((unsigned int)this);
138
+    SERIAL_EOL;
139
+
140
+    state.active = false;
141
+    state.z_offset = 0;
142
+    for (int x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
143
+      for (int y = 0; y < UBL_MESH_NUM_Y_POINTS; y++)
144
+        z_values[x][y] = NAN;
145
+  }
146
+
147
+  void bed_leveling::display_map(int map_type) {
148
+    float f, current_xi, current_yi;
149
+    int8_t i, j;
150
+    UNUSED(map_type);
151
+
152
+    SERIAL_PROTOCOLLNPGM("\nBed Topography Report:\n");
153
+
154
+    SERIAL_ECHOPAIR("(", 0);
155
+    SERIAL_ECHOPAIR(", ", UBL_MESH_NUM_Y_POINTS - 1);
156
+    SERIAL_ECHOPGM(")    ");
157
+
158
+    current_xi = blm.get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0);
159
+    current_yi = blm.get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0);
160
+
161
+    for (i = 0; i < UBL_MESH_NUM_X_POINTS - 1; i++)
162
+      SERIAL_ECHOPGM("                 ");
163
+
164
+    SERIAL_ECHOPAIR("(", UBL_MESH_NUM_X_POINTS - 1);
165
+    SERIAL_ECHOPAIR(",", UBL_MESH_NUM_Y_POINTS - 1);
166
+    SERIAL_ECHOLNPGM(")");
167
+
168
+    //  if (map_type || 1) {
169
+    SERIAL_ECHOPAIR("(", UBL_MESH_MIN_X);
170
+    SERIAL_ECHOPAIR(",", UBL_MESH_MAX_Y);
171
+    SERIAL_CHAR(')');
172
+
173
+    for (i = 0; i < UBL_MESH_NUM_X_POINTS - 1; i++)
174
+      SERIAL_ECHOPGM("                 ");
175
+
176
+    SERIAL_ECHOPAIR("(", UBL_MESH_MAX_X);
177
+    SERIAL_ECHOPAIR(",", UBL_MESH_MAX_Y);
178
+    SERIAL_ECHOLNPGM(")");
179
+    //  }
180
+
181
+    for (j = UBL_MESH_NUM_Y_POINTS - 1; j >= 0; j--) {
182
+      for (i = 0; i < UBL_MESH_NUM_X_POINTS; i++) {
183
+        f = z_values[i][j];
184
+
185
+        // is the nozzle here?  if so, mark the number
186
+        SERIAL_CHAR(i == current_xi && j == current_yi ? '[' : ' ');
187
+
188
+        if (isnan(f))
189
+          SERIAL_PROTOCOLPGM("      .       ");
190
+        else {
191
+          // if we don't do this, the columns won't line up nicely
192
+          if (f >= 0.0) SERIAL_CHAR(' ');
193
+          SERIAL_PROTOCOL_F(f, 5);
194
+          idle();
195
+        }
196
+        if (i == current_xi && j == current_yi) // is the nozzle here? if so, finish marking the number
197
+          SERIAL_CHAR(']');
198
+        else
199
+          SERIAL_PROTOCOL("  ");
200
+
201
+        SERIAL_CHAR(' ');
202
+      }
203
+      SERIAL_EOL;
204
+      if (j) { // we want the (0,0) up tight against the block of numbers
205
+        SERIAL_CHAR(' ');
206
+        SERIAL_EOL;
207
+      }
208
+    }
209
+
210
+    //  if (map_type) {
211
+    SERIAL_ECHOPAIR("(", int(UBL_MESH_MIN_X));
212
+    SERIAL_ECHOPAIR(",", int(UBL_MESH_MIN_Y));
213
+    SERIAL_ECHOPGM(")    ");
214
+
215
+    for (i = 0; i < UBL_MESH_NUM_X_POINTS - 1; i++)
216
+      SERIAL_ECHOPGM("                 ");
217
+
218
+    SERIAL_ECHOPAIR("(", int(UBL_MESH_MAX_X));
219
+    SERIAL_ECHOPAIR(",", int(UBL_MESH_MIN_Y));
220
+    SERIAL_CHAR(')');
221
+    //  }
222
+
223
+    SERIAL_ECHOPAIR("(", 0);
224
+    SERIAL_ECHOPAIR(",", 0);
225
+    SERIAL_ECHOPGM(")       ");
226
+
227
+    for (i = 0; i < UBL_MESH_NUM_X_POINTS - 1; i++)
228
+      SERIAL_ECHOPGM("                 ");
229
+
230
+    SERIAL_ECHOPAIR("(", UBL_MESH_NUM_X_POINTS-1);
231
+    SERIAL_ECHOPAIR(",", 0);
232
+    SERIAL_CHAR(')');
233
+
234
+    SERIAL_CHAR(' ');
235
+    SERIAL_EOL;
236
+  }
237
+
238
+  bool bed_leveling::sanity_check() {
239
+    uint8_t error_flag = 0;
240
+
241
+    if (state.n_x !=  UBL_MESH_NUM_X_POINTS)  {
242
+      SERIAL_PROTOCOLLNPGM("?UBL_MESH_NUM_X_POINTS set wrong\n");
243
+      error_flag++;
244
+    }
245
+
246
+    if (state.n_y !=  UBL_MESH_NUM_Y_POINTS)  {
247
+      SERIAL_PROTOCOLLNPGM("?UBL_MESH_NUM_Y_POINTS set wrong\n");
248
+      error_flag++;
249
+    }
250
+
251
+    if (state.mesh_x_min !=  UBL_MESH_MIN_X)  {
252
+      SERIAL_PROTOCOLLNPGM("?UBL_MESH_MIN_X set wrong\n");
253
+      error_flag++;
254
+    }
255
+
256
+    if (state.mesh_y_min !=  UBL_MESH_MIN_Y)  {
257
+      SERIAL_PROTOCOLLNPGM("?UBL_MESH_MIN_Y set wrong\n");
258
+      error_flag++;
259
+    }
260
+
261
+    if (state.mesh_x_max !=  UBL_MESH_MAX_X)  {
262
+      SERIAL_PROTOCOLLNPGM("?UBL_MESH_MAX_X set wrong\n");
263
+      error_flag++;
264
+    }
265
+
266
+    if (state.mesh_y_max !=  UBL_MESH_MAX_Y)  {
267
+      SERIAL_PROTOCOLLNPGM("?UBL_MESH_MAX_Y set wrong\n");
268
+      error_flag++;
269
+    }
270
+
271
+    if (state.mesh_x_dist !=  MESH_X_DIST)  {
272
+      SERIAL_PROTOCOLLNPGM("?MESH_X_DIST set wrong\n");
273
+      error_flag++;
274
+    }
275
+
276
+    if (state.mesh_y_dist !=  MESH_Y_DIST)  {
277
+      SERIAL_PROTOCOLLNPGM("?MESH_Y_DIST set wrong\n");
278
+      error_flag++;
279
+    }
280
+
281
+    int k = E2END - sizeof(blm.state),
282
+        j = (k - Unified_Bed_Leveling_EEPROM_start) / sizeof(z_values);
283
+
284
+    if (j < 1) {
285
+      SERIAL_PROTOCOLLNPGM("?No EEPROM storage available for a mesh of this size.\n");
286
+      error_flag++;
287
+    }
288
+
289
+    //  SERIAL_PROTOCOLPGM("?sanity_check() return value: ");
290
+    //  SERIAL_PROTOCOL(error_flag);
291
+    //  SERIAL_EOL;
292
+
293
+    return !!error_flag;
294
+  }
295
+
296
+#endif // AUTO_BED_LEVELING_UBL

+ 1455
- 0
Marlin/UBL_G29.cpp
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 553
- 0
Marlin/UBL_line_to_destination.cpp Просмотреть файл

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "Marlin.h"
23
+
24
+#if ENABLED(AUTO_BED_LEVELING_UBL)
25
+
26
+  #include "UBL.h"
27
+  #include "planner.h"
28
+  #include <avr/io.h>
29
+  #include <math.h>
30
+
31
+  extern void set_current_to_destination();
32
+  extern bool G26_Debug_flag;
33
+  void debug_current_and_destination(char *title);
34
+
35
+  void wait_for_button_press();
36
+
37
+  void UBL_line_to_destination(const float &x_end, const float &y_end, const float &z_end, const float &e_end, const float &feed_rate, uint8_t extruder) {
38
+
39
+    int cell_start_xi, cell_start_yi, cell_dest_xi, cell_dest_yi;
40
+    int left_flag, down_flag;
41
+    int current_xi, current_yi;
42
+    int dxi, dyi, xi_cnt, yi_cnt;
43
+    bool use_X_dist, inf_normalized_flag, inf_m_flag;
44
+    float x_start, y_start;
45
+    float x, y, z1, z2, z0 /*, z_optimized */;
46
+    float next_mesh_line_x, next_mesh_line_y, a0ma1diva2ma1;
47
+    float on_axis_distance, e_normalized_dist, e_position, e_start, z_normalized_dist, z_position, z_start;
48
+    float dx, dy, adx, ady, m, c;
49
+
50
+    //
51
+    // Much of the nozzle movement will be within the same cell.  So we will do as little computation
52
+    // as possible to determine if this is the case.  If this move is within the same cell, we will
53
+    // just do the required Z-Height correction, call the Planner's buffer_line() routine, and leave
54
+    //
55
+
56
+    x_start = current_position[X_AXIS];
57
+    y_start = current_position[Y_AXIS];
58
+    z_start = current_position[Z_AXIS];
59
+    e_start = current_position[E_AXIS];
60
+
61
+    cell_start_xi = blm.get_cell_index_x(x_start);
62
+    cell_start_yi = blm.get_cell_index_y(y_start);
63
+    cell_dest_xi  = blm.get_cell_index_x(x_end);
64
+    cell_dest_yi  = blm.get_cell_index_y(y_end);
65
+
66
+    if (G26_Debug_flag!=0) {
67
+      SERIAL_ECHOPGM(" UBL_line_to_destination(xe=");
68
+      SERIAL_ECHO(x_end);
69
+      SERIAL_ECHOPGM(",ye=");
70
+      SERIAL_ECHO(y_end);
71
+      SERIAL_ECHOPGM(",ze=");
72
+      SERIAL_ECHO(z_end);
73
+      SERIAL_ECHOPGM(",ee=");
74
+      SERIAL_ECHO(e_end);
75
+      SERIAL_ECHOPGM(")\n");
76
+      debug_current_and_destination( (char *) "Start of UBL_line_to_destination()");
77
+    }
78
+
79
+    if ((cell_start_xi == cell_dest_xi) && (cell_start_yi == cell_dest_yi)) { // if the whole move is within the same cell,
80
+      // we don't need to break up the move
81
+      //
82
+      // If we are moving off the print bed, we are going to allow the move at this level.
83
+      // But we detect it and isolate it.   For now, we just pass along the request.
84
+      //
85
+
86
+      if (cell_dest_xi<0 || cell_dest_yi<0 || cell_dest_xi >= UBL_MESH_NUM_X_POINTS || cell_dest_yi >= UBL_MESH_NUM_Y_POINTS) {
87
+
88
+        // Note:  There is no Z Correction in this case.  We are off the grid and don't know what
89
+        // a reasonable correction would be.
90
+
91
+        planner.buffer_line(x_end, y_end, z_end + blm.state.z_offset, e_end, feed_rate, extruder);
92
+        set_current_to_destination();
93
+        if (G26_Debug_flag!=0) {
94
+          debug_current_and_destination( (char *) "out of bounds in UBL_line_to_destination()");
95
+        }
96
+        return;
97
+      }
98
+
99
+      // we can optimize some floating point operations here.  We could call float get_z_correction(float x0, float y0) to
100
+      // generate the correction for us.  But we can lighten the load on the CPU by doing a modified version of the function.
101
+      // We are going to only calculate the amount we are from the first mesh line towards the second mesh line once.
102
+      // We will use this fraction in both of the original two Z Height calculations for the bi-linear interpolation.  And,
103
+      // instead of doing a generic divide of the distance, we know the distance is MESH_X_DIST so we can use the preprocessor
104
+      // to create a 1-over number for us.  That will allow us to do a floating point multiply instead of a floating point divide.
105
+
106
+      FINAL_MOVE:
107
+      a0ma1diva2ma1 = (x_end - mesh_index_to_X_location[cell_dest_xi]) * (float) (1.0 / MESH_X_DIST);
108
+
109
+      z1 = z_values[cell_dest_xi][cell_dest_yi] +
110
+      (z_values[cell_dest_xi + 1][cell_dest_yi] - z_values[cell_dest_xi][cell_dest_yi]) * a0ma1diva2ma1;
111
+
112
+      z2 = z_values[cell_dest_xi][cell_dest_yi+1] +
113
+      (z_values[cell_dest_xi+1][cell_dest_yi+1] - z_values[cell_dest_xi][cell_dest_yi+1]) * a0ma1diva2ma1;
114
+
115
+      // we are done with the fractional X distance into the cell.  Now with the two Z-Heights we have calculated, we
116
+      // are going to apply the Y-Distance into the cell to interpolate the final Z correction.
117
+
118
+      a0ma1diva2ma1 = (y_end - mesh_index_to_Y_location[cell_dest_yi]) * (float) (1.0 / MESH_Y_DIST);
119
+
120
+      z0 = z1 + (z2 - z1) * a0ma1diva2ma1;
121
+
122
+      // debug code to use non-optimized get_z_correction() and to do a sanity check
123
+      // that the correct value is being passed to planner.buffer_line()
124
+      //
125
+      /*
126
+        z_optimized = z0;
127
+        z0 = blm.get_z_correction( x_end, y_end);
128
+        if ( fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized) )  {
129
+        debug_current_and_destination( (char *) "FINAL_MOVE: z_correction()");
130
+        if ( isnan(z0) ) SERIAL_ECHO(" z0==NAN  ");
131
+        if ( isnan(z_optimized) ) SERIAL_ECHO(" z_optimized==NAN  ");
132
+        SERIAL_ECHOPAIR("  x_end=", x_end);
133
+        SERIAL_ECHOPAIR("  y_end=", y_end);
134
+        SERIAL_ECHOPAIR("  z0=", z0);
135
+        SERIAL_ECHOPAIR("  z_optimized=", z_optimized);
136
+        SERIAL_ECHOPAIR("  err=",fabs(z_optimized - z0));
137
+        SERIAL_EOL;
138
+        }
139
+      */
140
+      z0 = z0 * blm.fade_scaling_factor_for_Z( z_end );
141
+
142
+      if (isnan(z0)) {  // if part of the Mesh is undefined, it will show up as NAN
143
+        z0 = 0.0; // in z_values[][] and propagate through the
144
+        // calculations. If our correction is NAN, we throw it out
145
+        // because part of the Mesh is undefined and we don't have the
146
+        // information we need to complete the height correction.
147
+      }
148
+
149
+      planner.buffer_line(x_end, y_end, z_end + z0 + blm.state.z_offset, e_end, feed_rate, extruder);
150
+      if (G26_Debug_flag!=0) {
151
+        debug_current_and_destination( (char *) "FINAL_MOVE in UBL_line_to_destination()");
152
+      }
153
+      set_current_to_destination();
154
+      return;
155
+    }
156
+
157
+    //
158
+    //  If we get here, we are processing a move that crosses at least one Mesh Line.   We will check
159
+    //  for the simple case of just crossing X or just crossing Y Mesh Lines after we get all the details
160
+    //  of the move figured out.  We can process the easy case of just crossing an X or Y Mesh Line with less
161
+    //  computation and in fact most lines are of this nature.  We will check for that in the following
162
+    //  blocks of code:
163
+
164
+    left_flag = 0;
165
+    down_flag = 0;
166
+    inf_m_flag = false;
167
+    inf_normalized_flag = false;
168
+
169
+    dx = x_end - x_start;
170
+    dy = y_end - y_start;
171
+
172
+    if (dx<0.0) {     // figure out which way we need to move to get to the next cell
173
+      dxi = -1;
174
+      adx = -dx;  // absolute value of dx.  We already need to check if dx and dy are negative.
175
+    }
176
+    else {   // We may as well generate the appropriate values for adx and ady right now
177
+      dxi = 1;  // to save setting up the abs() function call and actually doing the call.
178
+      adx = dx;
179
+    }
180
+    if (dy<0.0) {
181
+      dyi = -1;
182
+      ady = -dy;  // absolute value of dy
183
+    }
184
+    else {
185
+      dyi = 1;
186
+      ady = dy;
187
+    }
188
+
189
+    if (dx<0.0) left_flag = 1;
190
+    if (dy<0.0) down_flag = 1;
191
+    if (cell_start_xi == cell_dest_xi) dxi = 0;
192
+    if (cell_start_yi == cell_dest_yi) dyi = 0;
193
+
194
+    //
195
+    // Compute the scaling factor for the extruder for each partial move.
196
+    // We need to watch out for zero length moves because it will cause us to
197
+    // have an infinate scaling factor.  We are stuck doing a floating point
198
+    // divide to get our scaling factor, but after that, we just multiply by this
199
+    // number.   We also pick our scaling factor based on whether the X or Y
200
+    // component is larger.  We use the biggest of the two to preserve precision.
201
+    //
202
+    if ( adx > ady ) {
203
+      use_X_dist = true;
204
+      on_axis_distance   = x_end-x_start;
205
+    }
206
+    else {
207
+      use_X_dist = false;
208
+      on_axis_distance   = y_end-y_start;
209
+    }
210
+    e_position = e_end - e_start;
211
+    e_normalized_dist = e_position / on_axis_distance;
212
+
213
+    z_position = z_end - z_start;
214
+    z_normalized_dist = z_position / on_axis_distance;
215
+
216
+    if (e_normalized_dist==INFINITY || e_normalized_dist==-INFINITY) {
217
+      inf_normalized_flag = true;
218
+    }
219
+    current_xi = cell_start_xi;
220
+    current_yi = cell_start_yi;
221
+
222
+    m = dy / dx;
223
+    c = y_start - m*x_start;
224
+    if (m == INFINITY || m == -INFINITY) {
225
+      inf_m_flag = true;
226
+    }
227
+    //
228
+    // This block handles vertical lines.  These are lines that stay within the same
229
+    // X Cell column.  They do not need to be perfectly vertical.  They just can
230
+    // not cross into another X Cell column.
231
+    //
232
+    if (dxi == 0) {       // Check for a vertical line
233
+      current_yi += down_flag;  // Line is heading down, we just want to go to the bottom
234
+      while (current_yi != cell_dest_yi + down_flag) {
235
+        current_yi += dyi;
236
+        next_mesh_line_y = mesh_index_to_Y_location[current_yi];
237
+        if (inf_m_flag) {
238
+          x = x_start;  // if the slope of the line is infinite, we won't do the calculations
239
+        }
240
+        // we know the next X is the same so we can recover and continue!
241
+        else {
242
+          x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line
243
+        }
244
+
245
+        z0 = blm.get_z_correction_along_horizontal_mesh_line_at_specific_X(x, current_xi, current_yi);
246
+
247
+        //
248
+        // debug code to use non-optimized get_z_correction() and to do a sanity check
249
+        // that the correct value is being passed to planner.buffer_line()
250
+        //
251
+        /*
252
+          z_optimized = z0;
253
+          z0 = blm.get_z_correction( x, next_mesh_line_y);
254
+          if ( fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized) )  {
255
+          debug_current_and_destination( (char *) "VERTICAL z_correction()");
256
+          if ( isnan(z0) ) SERIAL_ECHO(" z0==NAN  ");
257
+          if ( isnan(z_optimized) ) SERIAL_ECHO(" z_optimized==NAN  ");
258
+          SERIAL_ECHOPAIR("  x=", x);
259
+          SERIAL_ECHOPAIR("  next_mesh_line_y=", next_mesh_line_y);
260
+          SERIAL_ECHOPAIR("  z0=", z0);
261
+          SERIAL_ECHOPAIR("  z_optimized=", z_optimized);
262
+          SERIAL_ECHOPAIR("  err=",fabs(z_optimized-z0));
263
+          SERIAL_ECHO("\n");
264
+          }
265
+        */
266
+
267
+        z0 = z0 * blm.fade_scaling_factor_for_Z( z_end );
268
+
269
+        if (isnan(z0)) {  // if part of the Mesh is undefined, it will show up as NAN
270
+          z0 = 0.0; // in z_values[][] and propagate through the
271
+          // calculations. If our correction is NAN, we throw it out
272
+          // because part of the Mesh is undefined and we don't have the
273
+          // information we need to complete the height correction.
274
+        }
275
+        y = mesh_index_to_Y_location[current_yi];
276
+
277
+        // Without this check, it is possible for the algorythm to generate a zero length move in the case
278
+        // where the line is heading down and it is starting right on a Mesh Line boundary.  For how often that
279
+        // happens, it might be best to remove the check and always 'schedule' the move because
280
+        // the planner.buffer_line() routine will filter it if that happens.
281
+        if ( y!=y_start)   {
282
+          if ( inf_normalized_flag == false ) {
283
+            on_axis_distance   = y - y_start;       // we don't need to check if the extruder position
284
+            e_position = e_start + on_axis_distance * e_normalized_dist;  // is based on X or Y because this is a vertical move
285
+            z_position = z_start + on_axis_distance * z_normalized_dist;
286
+          }
287
+          else {
288
+            e_position = e_start;
289
+            z_position = z_start;
290
+          }
291
+
292
+          planner.buffer_line(x, y, z_position + z0 + blm.state.z_offset, e_position, feed_rate, extruder);
293
+        } //else printf("FIRST MOVE PRUNED  ");
294
+      }
295
+      //
296
+      // Check if we are at the final destination.  Usually, we won't be, but if it is on a Y Mesh Line, we are done.
297
+      //
298
+      if (G26_Debug_flag!=0) {
299
+        debug_current_and_destination( (char *) "vertical move done in UBL_line_to_destination()");
300
+      }
301
+      if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end) {
302
+        goto FINAL_MOVE;
303
+      }
304
+      set_current_to_destination();
305
+      return;
306
+    }
307
+
308
+    //
309
+    // This block handles horizontal lines.  These are lines that stay within the same
310
+    // Y Cell row.  They do not need to be perfectly horizontal.  They just can
311
+    // not cross into another Y Cell row.
312
+    //
313
+
314
+    if (dyi == 0) {       // Check for a horiziontal line
315
+      current_xi += left_flag;  // Line is heading left, we just want to go to the left
316
+      // edge of this cell for the first move.
317
+      while (current_xi != cell_dest_xi + left_flag) {
318
+        current_xi += dxi;
319
+        next_mesh_line_x = mesh_index_to_X_location[current_xi];
320
+        y = m * next_mesh_line_x + c;   // Calculate X at the next Y mesh line
321
+
322
+        z0 = blm.get_z_correction_along_vertical_mesh_line_at_specific_Y(y, current_xi, current_yi);
323
+
324
+        //
325
+        // debug code to use non-optimized get_z_correction() and to do a sanity check
326
+        // that the correct value is being passed to planner.buffer_line()
327
+        //
328
+        /*
329
+          z_optimized = z0;
330
+          z0 = blm.get_z_correction( next_mesh_line_x, y);
331
+          if ( fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized) )  {
332
+          debug_current_and_destination( (char *) "HORIZONTAL z_correction()");
333
+          if ( isnan(z0) ) SERIAL_ECHO(" z0==NAN  ");
334
+          if ( isnan(z_optimized) ) SERIAL_ECHO(" z_optimized==NAN  ");
335
+          SERIAL_ECHOPAIR("  next_mesh_line_x=", next_mesh_line_x);
336
+          SERIAL_ECHOPAIR("  y=", y);
337
+          SERIAL_ECHOPAIR("  z0=", z0);
338
+          SERIAL_ECHOPAIR("  z_optimized=", z_optimized);
339
+          SERIAL_ECHOPAIR("  err=",fabs(z_optimized-z0));
340
+          SERIAL_ECHO("\n");
341
+          }
342
+        */
343
+
344
+        z0 = z0 * blm.fade_scaling_factor_for_Z( z_end );
345
+
346
+        if (isnan(z0)) {  // if part of the Mesh is undefined, it will show up as NAN
347
+          z0 = 0.0; // in z_values[][] and propagate through the
348
+          // calculations. If our correction is NAN, we throw it out
349
+          // because part of the Mesh is undefined and we don't have the
350
+          // information we need to complete the height correction.
351
+        }
352
+        x = mesh_index_to_X_location[current_xi];
353
+
354
+        // Without this check, it is possible for the algorythm to generate a zero length move in the case
355
+        // where the line is heading left and it is starting right on a Mesh Line boundary.  For how often
356
+        // that happens, it might be best to remove the check and always 'schedule' the move because
357
+        // the planner.buffer_line() routine will filter it if that happens.
358
+        if ( x!=x_start)   {
359
+          if ( inf_normalized_flag == false ) {
360
+            on_axis_distance   = x - x_start;       // we don't need to check if the extruder position
361
+            e_position = e_start + on_axis_distance * e_normalized_dist;  // is based on X or Y because this is a horizontal move
362
+            z_position = z_start + on_axis_distance * z_normalized_dist;
363
+          }
364
+          else {
365
+            e_position = e_start;
366
+            z_position = z_start;
367
+          }
368
+
369
+          planner.buffer_line(x, y, z_position + z0 + blm.state.z_offset, e_position, feed_rate, extruder);
370
+        } //else printf("FIRST MOVE PRUNED  ");
371
+      }
372
+      if (G26_Debug_flag!=0) {
373
+        debug_current_and_destination( (char *) "horizontal move done in UBL_line_to_destination()");
374
+      }
375
+      if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end) {
376
+        goto FINAL_MOVE;
377
+      }
378
+      set_current_to_destination();
379
+      return;
380
+    }
381
+
382
+    //
383
+    //
384
+    //
385
+    //
386
+    // This block handles the generic case of a line crossing both X and Y
387
+    // Mesh lines.
388
+    //
389
+    //
390
+    //
391
+    //
392
+
393
+    xi_cnt = cell_start_xi - cell_dest_xi;
394
+    if ( xi_cnt < 0 ) {
395
+      xi_cnt = -xi_cnt;
396
+    }
397
+
398
+    yi_cnt = cell_start_yi - cell_dest_yi;
399
+    if ( yi_cnt < 0 ) {
400
+      yi_cnt = -yi_cnt;
401
+    }
402
+
403
+    current_xi += left_flag;
404
+    current_yi += down_flag;
405
+
406
+    while ( xi_cnt>0 || yi_cnt>0 )    {
407
+
408
+      next_mesh_line_x = mesh_index_to_X_location[current_xi + dxi];
409
+      next_mesh_line_y = mesh_index_to_Y_location[current_yi + dyi];
410
+
411
+      y = m * next_mesh_line_x + c; // Calculate Y at the next X mesh line
412
+      x = (next_mesh_line_y-c) / m; // Calculate X at the next Y mesh line    (we don't have to worry
413
+      // about m being equal to 0.0  If this was the case, we would have
414
+      // detected this as a vertical line move up above and we wouldn't
415
+      // be down here doing a generic type of move.
416
+
417
+      if ((left_flag && (x>next_mesh_line_x)) || (!left_flag && (x<next_mesh_line_x))) { // Check if we hit the Y line first
418
+        //
419
+        // Yes!  Crossing a Y Mesh Line next
420
+        //
421
+        z0 = blm.get_z_correction_along_horizontal_mesh_line_at_specific_X(x, current_xi-left_flag, current_yi+dyi);
422
+
423
+        //
424
+        // debug code to use non-optimized get_z_correction() and to do a sanity check
425
+        // that the correct value is being passed to planner.buffer_line()
426
+        //
427
+
428
+        /*
429
+
430
+          z_optimized = z0;
431
+
432
+          z0 = blm.get_z_correction( x, next_mesh_line_y);
433
+          if ( fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized) )  {
434
+            debug_current_and_destination( (char *) "General_1: z_correction()");
435
+            if ( isnan(z0) ) SERIAL_ECHO(" z0==NAN  ");
436
+            if ( isnan(z_optimized) ) SERIAL_ECHO(" z_optimized==NAN  "); {
437
+              SERIAL_ECHOPAIR("  x=", x);
438
+            }
439
+            SERIAL_ECHOPAIR("  next_mesh_line_y=", next_mesh_line_y);
440
+            SERIAL_ECHOPAIR("  z0=", z0);
441
+            SERIAL_ECHOPAIR("  z_optimized=", z_optimized);
442
+            SERIAL_ECHOPAIR("  err=",fabs(z_optimized-z0));
443
+            SERIAL_ECHO("\n");
444
+          }
445
+        */
446
+
447
+        z0 = z0 * blm.fade_scaling_factor_for_Z( z_end );
448
+        if (isnan(z0)) {  // if part of the Mesh is undefined, it will show up as NAN
449
+          z0 = 0.0; // in z_values[][] and propagate through the
450
+          // calculations. If our correction is NAN, we throw it out
451
+          // because part of the Mesh is undefined and we don't have the
452
+          // information we need to complete the height correction.
453
+        }
454
+
455
+        if ( inf_normalized_flag == false ) {
456
+          if ( use_X_dist ) {
457
+            on_axis_distance   = x - x_start;
458
+          }
459
+          else {
460
+            on_axis_distance   = next_mesh_line_y - y_start;
461
+          }
462
+          e_position = e_start + on_axis_distance * e_normalized_dist;
463
+          z_position = z_start + on_axis_distance * z_normalized_dist;
464
+        }
465
+        else {
466
+          e_position = e_start;
467
+          z_position = z_start;
468
+        }
469
+        planner.buffer_line(x, next_mesh_line_y, z_position + z0 + blm.state.z_offset, e_position, feed_rate, extruder);
470
+        current_yi += dyi;
471
+        yi_cnt--;
472
+      }
473
+      else {
474
+        //
475
+        // Yes!  Crossing a X Mesh Line next
476
+        //
477
+        z0 = blm.get_z_correction_along_vertical_mesh_line_at_specific_Y(y, current_xi+dxi, current_yi-down_flag);
478
+
479
+
480
+        //
481
+        // debug code to use non-optimized get_z_correction() and to do a sanity check
482
+        // that the correct value is being passed to planner.buffer_line()
483
+        //
484
+        /*
485
+          z_optimized = z0;
486
+          z0 = blm.get_z_correction( next_mesh_line_x, y);
487
+          if ( fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized) )  {
488
+          debug_current_and_destination( (char *) "General_2: z_correction()");
489
+          if ( isnan(z0) ) SERIAL_ECHO(" z0==NAN  ");
490
+          if ( isnan(z_optimized) ) SERIAL_ECHO(" z_optimized==NAN  ");
491
+          SERIAL_ECHOPAIR("  next_mesh_line_x=", next_mesh_line_x);
492
+          SERIAL_ECHOPAIR("  y=", y);
493
+          SERIAL_ECHOPAIR("  z0=", z0);
494
+          SERIAL_ECHOPAIR("  z_optimized=", z_optimized);
495
+          SERIAL_ECHOPAIR("  err=",fabs(z_optimized-z0));
496
+          SERIAL_ECHO("\n");
497
+          }
498
+        */
499
+
500
+        z0 = z0 * blm.fade_scaling_factor_for_Z( z_end );
501
+
502
+        if (isnan(z0)) {  // if part of the Mesh is undefined, it will show up as NAN
503
+          z0 = 0.0; // in z_values[][] and propagate through the
504
+          // calculations. If our correction is NAN, we throw it out
505
+          // because part of the Mesh is undefined and we don't have the
506
+          // information we need to complete the height correction.
507
+        }
508
+        if ( inf_normalized_flag == false ) {
509
+          if ( use_X_dist ) {
510
+            on_axis_distance   = next_mesh_line_x - x_start;
511
+          }
512
+          else {
513
+            on_axis_distance   = y - y_start;
514
+          }
515
+          e_position = e_start + on_axis_distance * e_normalized_dist;
516
+          z_position = z_start + on_axis_distance * z_normalized_dist;
517
+        }
518
+        else {
519
+          e_position = e_start;
520
+          z_position = z_start;
521
+        }
522
+
523
+        planner.buffer_line(next_mesh_line_x, y, z_position + z0 + blm.state.z_offset, e_position, feed_rate, extruder);
524
+        current_xi += dxi;
525
+        xi_cnt--;
526
+      }
527
+    }
528
+    if (G26_Debug_flag) {
529
+      debug_current_and_destination( (char *) "generic move done in UBL_line_to_destination()");
530
+    }
531
+    if (current_position[0] != x_end || current_position[1] != y_end)  {
532
+      goto FINAL_MOVE;
533
+    }
534
+    set_current_to_destination();
535
+    return;
536
+  }
537
+
538
+  void wait_for_button_press() {
539
+    //  if ( !been_to_2_6 )
540
+    //return;   // bob - I think this should be commented out
541
+
542
+    SET_INPUT_PULLUP(66); // Roxy's Left Switch is on pin 66.  Right Switch is on pin 65
543
+    SET_OUTPUT(64);
544
+    while (READ(66) & 0x01) idle();
545
+
546
+    delay(50);
547
+    while (!(READ(66) & 0x01)) idle();
548
+    delay(50);
549
+  }
550
+
551
+#endif
552
+
553
+

+ 83
- 1
Marlin/configuration_store.cpp Просмотреть файл

164
   #include "stepper_indirection.h"
164
   #include "stepper_indirection.h"
165
 #endif
165
 #endif
166
 
166
 
167
+#if ENABLED(AUTO_BED_LEVELING_UBL)
168
+  #include "UBL.h"
169
+#endif
170
+
167
 #if ENABLED(ABL_BILINEAR_SUBDIVISION)
171
 #if ENABLED(ABL_BILINEAR_SUBDIVISION)
168
   extern void bed_level_virt_interpolate();
172
   extern void bed_level_virt_interpolate();
169
 #endif
173
 #endif
534
       SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
538
       SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
535
       SERIAL_ECHOLNPGM(" bytes)");
539
       SERIAL_ECHOLNPGM(" bytes)");
536
     }
540
     }
541
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
542
+      blm.store_state();
543
+      if (blm.state.EEPROM_storage_slot >= 0)
544
+        blm.store_mesh(blm.state.EEPROM_storage_slot);
545
+    #endif
537
   }
546
   }
538
 
547
 
539
   /**
548
   /**
832
         SERIAL_ERRORLNPGM("EEPROM checksum mismatch");
841
         SERIAL_ERRORLNPGM("EEPROM checksum mismatch");
833
         Config_ResetDefault();
842
         Config_ResetDefault();
834
       }
843
       }
835
-   }
836
 
844
 
845
+      #if ENABLED(AUTO_BED_LEVELING_UBL)
846
+        Unified_Bed_Leveling_EEPROM_start = (eeprom_index + 32) & 0xFFF8; // Pad the end of configuration data so it
847
+                                                                          // can float up or down a little bit without
848
+                                                                          // disrupting the Unified Bed Leveling data
849
+        blm.load_state();
850
+
851
+        SERIAL_ECHOPGM(" UBL ");
852
+        if (!blm.state.active) SERIAL_ECHO("not ");
853
+        SERIAL_ECHOLNPGM("active!");
854
+
855
+        if (!blm.sanity_check()) {
856
+          int tmp_mesh;                                // We want to preserve whether the UBL System is Active
857
+          bool tmp_active;                             // If it is, we want to preserve the Mesh that is being used.
858
+          tmp_mesh = blm.state.EEPROM_storage_slot;
859
+          tmp_active = blm.state.active;
860
+          SERIAL_ECHOLNPGM("\nInitializing Bed Leveling State to current firmware settings.\n");
861
+          blm.state = blm.pre_initialized;             // Initialize with the pre_initialized data structure
862
+          blm.state.EEPROM_storage_slot = tmp_mesh;    // But then restore some data we don't want mangled
863
+          blm.state.active = tmp_active;
864
+        }
865
+        else {
866
+          SERIAL_PROTOCOLPGM("?Unable to enable Unified Bed Leveling.\n");
867
+          blm.state = blm.pre_initialized;
868
+          blm.reset();
869
+          blm.store_state();
870
+        }
871
+
872
+        if (blm.state.EEPROM_storage_slot >= 0)  {
873
+          blm.load_mesh(blm.state.EEPROM_storage_slot);
874
+          SERIAL_ECHOPAIR("Mesh ", blm.state.EEPROM_storage_slot);
875
+          SERIAL_ECHOLNPGM(" loaded from storage.");
876
+        }
877
+        else {
878
+          blm.reset();
879
+          SERIAL_ECHOPGM("UBL System reset() \n");
880
+        }
881
+      #endif
882
+    }
837
     #if ENABLED(EEPROM_CHITCHAT)
883
     #if ENABLED(EEPROM_CHITCHAT)
838
       Config_PrintSettings();
884
       Config_PrintSettings();
839
     #endif
885
     #endif
1126
       SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
1172
       SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS]);
1127
       SERIAL_EOL;
1173
       SERIAL_EOL;
1128
     #endif
1174
     #endif
1175
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
1176
+    SERIAL_ECHOLNPGM("Unified Bed Leveling:");
1177
+    CONFIG_ECHO_START;
1178
+
1179
+    SERIAL_ECHOPGM("System is: ");
1180
+    if (blm.state.active)
1181
+       SERIAL_ECHOLNPGM("Active\n");
1182
+    else
1183
+       SERIAL_ECHOLNPGM("Deactive\n");
1184
+
1185
+    SERIAL_ECHOPAIR("Active Mesh Slot: ", blm.state.EEPROM_storage_slot);
1186
+    SERIAL_EOL;
1187
+
1188
+    SERIAL_ECHOPGM("z_offset: ");
1189
+    SERIAL_ECHO_F(blm.state.z_offset, 6);
1190
+    SERIAL_EOL;
1191
+
1192
+    SERIAL_ECHOPAIR("EEPROM can hold ", (int)((E2END - sizeof(blm.state) - Unified_Bed_Leveling_EEPROM_start) / sizeof(z_values)));
1193
+    SERIAL_ECHOLNPGM(" meshes. \n");
1194
+
1195
+    SERIAL_ECHOPAIR("\nUBL_MESH_NUM_X_POINTS  ", UBL_MESH_NUM_X_POINTS);
1196
+    SERIAL_ECHOPAIR("\nUBL_MESH_NUM_Y_POINTS  ", UBL_MESH_NUM_Y_POINTS);
1197
+
1198
+    SERIAL_ECHOPAIR("\nUBL_MESH_MIN_X         ", UBL_MESH_MIN_X);
1199
+    SERIAL_ECHOPAIR("\nUBL_MESH_MIN_Y         ", UBL_MESH_MIN_Y);
1200
+
1201
+    SERIAL_ECHOPAIR("\nUBL_MESH_MAX_X         ", UBL_MESH_MAX_X);
1202
+    SERIAL_ECHOPAIR("\nUBL_MESH_MAX_Y         ", UBL_MESH_MAX_Y);
1203
+
1204
+    SERIAL_ECHOPGM("\nMESH_X_DIST        ");
1205
+    SERIAL_ECHO_F(MESH_X_DIST, 6);
1206
+    SERIAL_ECHOPGM("\nMESH_Y_DIST        ");
1207
+    SERIAL_ECHO_F(MESH_Y_DIST, 6);
1208
+    SERIAL_EOL;
1209
+    SERIAL_EOL;
1210
+  #endif
1129
 
1211
 
1130
     #if HOTENDS > 1
1212
     #if HOTENDS > 1
1131
       CONFIG_ECHO_START;
1213
       CONFIG_ECHO_START;

+ 58
- 35
Marlin/example_configurations/Cartesio/Configuration.h Просмотреть файл

232
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
233
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    66 : 4.7M High Temperature thermistor from Dyze Design
234
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
  *    70 : the 100K thermistor found in the bq Hephestos 2
235
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
235
  *
236
  *
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
237
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
237
  *                              (but gives greater accuracy and more stable PID)
238
  *                              (but gives greater accuracy and more stable PID)
603
 //
604
 //
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 //
606
 //
606
-// For a servo-based Z probe, you must set up servo support below, including
607
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
607
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
608
 //
608
 //
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
610
 // - Use 5V for powered (usu. inductive) sensors.
610
 // - Use 5V for powered (usu. inductive) sensors.
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
742
 #endif
742
 #endif
743
 
743
 
744
-//===========================================================================
745
-//============================ Mesh Bed Leveling ============================
746
-//===========================================================================
747
-
748
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
749
-
750
-#if ENABLED(MESH_BED_LEVELING)
751
-  #define MESH_INSET 10        // Mesh inset margin on print area
752
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
753
-  #define MESH_NUM_Y_POINTS 3
754
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
755
-
756
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
757
-
758
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
759
-
760
-  #if ENABLED(MANUAL_BED_LEVELING)
761
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
762
-  #endif  // MANUAL_BED_LEVELING
763
-
764
-  // Gradually reduce leveling correction until a set height is reached,
765
-  // at which point movement will be level to the machine's XY plane.
766
-  // The height can be set with M420 Z<height>
767
-  #define ENABLE_LEVELING_FADE_HEIGHT
768
-
769
-#endif  // MESH_BED_LEVELING
770
 
744
 
771
 //===========================================================================
745
 //===========================================================================
772
-//============================ Auto Bed Leveling ============================
746
+//=============================== Bed Leveling ==============================
773
 //===========================================================================
747
 //===========================================================================
774
 // @section bedlevel
748
 // @section bedlevel
775
 
749
 
793
  *   Probe several points in a grid.
767
  *   Probe several points in a grid.
794
  *   You specify the rectangle and the density of sample points.
768
  *   You specify the rectangle and the density of sample points.
795
  *   The result is a mesh, best for large or uneven beds.
769
  *   The result is a mesh, best for large or uneven beds.
770
+ *
771
+ * - UBL Unified Bed Leveling
772
+ *   A comprehensive bed leveling system that combines features and benefits from previous
773
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
774
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
775
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
776
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
777
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
778
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
779
+ *       test on.
796
  */
780
  */
797
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_3POINT
798
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_LINEAR
799
 //#define AUTO_BED_LEVELING_BILINEAR
783
 //#define AUTO_BED_LEVELING_BILINEAR
784
+//#define MESH_BED_LEVELING
785
+//#define AUTO_BED_LEVELING_UBL
800
 
786
 
801
 /**
787
 /**
802
  * Enable detailed logging of G28, G29, M48, etc.
788
  * Enable detailed logging of G28, G29, M48, etc.
805
  */
791
  */
806
 //#define DEBUG_LEVELING_FEATURE
792
 //#define DEBUG_LEVELING_FEATURE
807
 
793
 
794
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
795
+  // Gradually reduce leveling correction until a set height is reached,
796
+  // at which point movement will be level to the machine's XY plane.
797
+  // The height can be set with M420 Z<height>
798
+  #define ENABLE_LEVELING_FADE_HEIGHT
799
+#endif
800
+
808
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
 
802
 
810
   // Set the number of grid points per dimension.
803
   // Set the number of grid points per dimension.
825
 
818
 
826
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
827
 
820
 
828
-    // Gradually reduce leveling correction until a set height is reached,
829
-    // at which point movement will be level to the machine's XY plane.
830
-    // The height can be set with M420 Z<height>
831
-    #define ENABLE_LEVELING_FADE_HEIGHT
832
-
833
     //
821
     //
834
     // Experimental Subdivision of the grid by Catmull-Rom method.
822
     // Experimental Subdivision of the grid by Catmull-Rom method.
835
     // Synthesizes intermediate points to produce a more detailed mesh.
823
     // Synthesizes intermediate points to produce a more detailed mesh.
853
   #define ABL_PROBE_PT_3_X 170
841
   #define ABL_PROBE_PT_3_X 170
854
   #define ABL_PROBE_PT_3_Y 20
842
   #define ABL_PROBE_PT_3_Y 20
855
 
843
 
856
-#endif
844
+#elif ENABLED(MESH_BED_LEVELING)
845
+
846
+//===========================================================================
847
+//=================================== Mesh ==================================
848
+//===========================================================================
849
+
850
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
851
+  #define MESH_INSET 10          // Mesh inset margin on print area
852
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
853
+  #define MESH_NUM_Y_POINTS 3
854
+
855
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
856
+
857
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
858
+
859
+  #if ENABLED(MANUAL_BED_LEVELING)
860
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
861
+  #endif  // MANUAL_BED_LEVELING
862
+
863
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
864
+
865
+//===========================================================================
866
+//========================= Unified Bed Leveling ============================
867
+//===========================================================================
868
+
869
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
870
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
871
+  #define UBL_MESH_NUM_Y_POINTS 10
872
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
873
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
874
+  #define UBL_PROBE_PT_2_X 39
875
+  #define UBL_PROBE_PT_2_Y 20
876
+  #define UBL_PROBE_PT_3_X 180
877
+  #define UBL_PROBE_PT_3_Y 20
878
+
879
+#endif  // BED_LEVELING
857
 
880
 
858
 /**
881
 /**
859
  * Commands to execute at the end of G29 probing.
882
  * Commands to execute at the end of G29 probing.

+ 22
- 34
Marlin/example_configurations/Felix/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
586
 //
587
 //
587
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
588
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
588
 //
589
 //
589
-// For a servo-based Z probe, you must set up servo support below, including
590
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
590
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
591
 //
591
 //
592
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
592
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
593
 // - Use 5V for powered (usu. inductive) sensors.
593
 // - Use 5V for powered (usu. inductive) sensors.
724
   #define FILAMENT_RUNOUT_SCRIPT "M600"
724
   #define FILAMENT_RUNOUT_SCRIPT "M600"
725
 #endif
725
 #endif
726
 
726
 
727
-//===========================================================================
728
-//============================ Mesh Bed Leveling ============================
729
-//===========================================================================
730
-
731
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
732
-
733
-#if ENABLED(MESH_BED_LEVELING)
734
-  #define MESH_INSET 10        // Mesh inset margin on print area
735
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
736
-  #define MESH_NUM_Y_POINTS 3
737
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
738
-
739
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
740
-
741
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
742
-
743
-  #if ENABLED(MANUAL_BED_LEVELING)
744
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
745
-  #endif  // MANUAL_BED_LEVELING
746
-
747
-  // Gradually reduce leveling correction until a set height is reached,
748
-  // at which point movement will be level to the machine's XY plane.
749
-  // The height can be set with M420 Z<height>
750
-  #define ENABLE_LEVELING_FADE_HEIGHT
751
-
752
-#endif  // MESH_BED_LEVELING
753
 
727
 
754
 //===========================================================================
728
 //===========================================================================
755
-//============================ Auto Bed Leveling ============================
729
+//=============================== Bed Leveling ==============================
756
 //===========================================================================
730
 //===========================================================================
757
 // @section bedlevel
731
 // @section bedlevel
758
 
732
 
776
  *   Probe several points in a grid.
750
  *   Probe several points in a grid.
777
  *   You specify the rectangle and the density of sample points.
751
  *   You specify the rectangle and the density of sample points.
778
  *   The result is a mesh, best for large or uneven beds.
752
  *   The result is a mesh, best for large or uneven beds.
753
+ *
754
+ * - UBL Unified Bed Leveling
755
+ *   A comprehensive bed leveling system that combines features and benefits from previous
756
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
757
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
758
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
759
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
760
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
761
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
762
+ *       test on.
779
  */
763
  */
780
 //#define AUTO_BED_LEVELING_3POINT
764
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_LINEAR
765
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_BILINEAR
766
 //#define AUTO_BED_LEVELING_BILINEAR
767
+//#define MESH_BED_LEVELING
768
+//#define AUTO_BED_LEVELING_UBL
783
 
769
 
784
 /**
770
 /**
785
  * Enable detailed logging of G28, G29, M48, etc.
771
  * Enable detailed logging of G28, G29, M48, etc.
788
  */
774
  */
789
 //#define DEBUG_LEVELING_FEATURE
775
 //#define DEBUG_LEVELING_FEATURE
790
 
776
 
777
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
778
+  // Gradually reduce leveling correction until a set height is reached,
779
+  // at which point movement will be level to the machine's XY plane.
780
+  // The height can be set with M420 Z<height>
781
+  #define ENABLE_LEVELING_FADE_HEIGHT
782
+#endif
783
+
791
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
784
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
792
 
785
 
793
   // Set the number of grid points per dimension.
786
   // Set the number of grid points per dimension.
808
 
801
 
809
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
802
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
810
 
803
 
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
-
816
     //
804
     //
817
     // Experimental Subdivision of the grid by Catmull-Rom method.
805
     // Experimental Subdivision of the grid by Catmull-Rom method.
818
     // Synthesizes intermediate points to produce a more detailed mesh.
806
     // Synthesizes intermediate points to produce a more detailed mesh.

+ 58
- 35
Marlin/example_configurations/Felix/DUAL/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
586
 //
587
 //
587
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
588
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
588
 //
589
 //
589
-// For a servo-based Z probe, you must set up servo support below, including
590
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
590
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
591
 //
591
 //
592
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
592
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
593
 // - Use 5V for powered (usu. inductive) sensors.
593
 // - Use 5V for powered (usu. inductive) sensors.
724
   #define FILAMENT_RUNOUT_SCRIPT "M600"
724
   #define FILAMENT_RUNOUT_SCRIPT "M600"
725
 #endif
725
 #endif
726
 
726
 
727
-//===========================================================================
728
-//============================ Mesh Bed Leveling ============================
729
-//===========================================================================
730
-
731
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
732
-
733
-#if ENABLED(MESH_BED_LEVELING)
734
-  #define MESH_INSET 10        // Mesh inset margin on print area
735
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
736
-  #define MESH_NUM_Y_POINTS 3
737
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
738
-
739
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
740
-
741
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
742
-
743
-  #if ENABLED(MANUAL_BED_LEVELING)
744
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
745
-  #endif  // MANUAL_BED_LEVELING
746
-
747
-  // Gradually reduce leveling correction until a set height is reached,
748
-  // at which point movement will be level to the machine's XY plane.
749
-  // The height can be set with M420 Z<height>
750
-  #define ENABLE_LEVELING_FADE_HEIGHT
751
-
752
-#endif  // MESH_BED_LEVELING
753
 
727
 
754
 //===========================================================================
728
 //===========================================================================
755
-//============================ Auto Bed Leveling ============================
729
+//=============================== Bed Leveling ==============================
756
 //===========================================================================
730
 //===========================================================================
757
 // @section bedlevel
731
 // @section bedlevel
758
 
732
 
776
  *   Probe several points in a grid.
750
  *   Probe several points in a grid.
777
  *   You specify the rectangle and the density of sample points.
751
  *   You specify the rectangle and the density of sample points.
778
  *   The result is a mesh, best for large or uneven beds.
752
  *   The result is a mesh, best for large or uneven beds.
753
+ *
754
+ * - UBL Unified Bed Leveling
755
+ *   A comprehensive bed leveling system that combines features and benefits from previous
756
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
757
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
758
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
759
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
760
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
761
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
762
+ *       test on.
779
  */
763
  */
780
 //#define AUTO_BED_LEVELING_3POINT
764
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_LINEAR
765
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_BILINEAR
766
 //#define AUTO_BED_LEVELING_BILINEAR
767
+//#define MESH_BED_LEVELING
768
+//#define AUTO_BED_LEVELING_UBL
783
 
769
 
784
 /**
770
 /**
785
  * Enable detailed logging of G28, G29, M48, etc.
771
  * Enable detailed logging of G28, G29, M48, etc.
788
  */
774
  */
789
 //#define DEBUG_LEVELING_FEATURE
775
 //#define DEBUG_LEVELING_FEATURE
790
 
776
 
777
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
778
+  // Gradually reduce leveling correction until a set height is reached,
779
+  // at which point movement will be level to the machine's XY plane.
780
+  // The height can be set with M420 Z<height>
781
+  #define ENABLE_LEVELING_FADE_HEIGHT
782
+#endif
783
+
791
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
784
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
792
 
785
 
793
   // Set the number of grid points per dimension.
786
   // Set the number of grid points per dimension.
808
 
801
 
809
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
802
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
810
 
803
 
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
-
816
     //
804
     //
817
     // Experimental Subdivision of the grid by Catmull-Rom method.
805
     // Experimental Subdivision of the grid by Catmull-Rom method.
818
     // Synthesizes intermediate points to produce a more detailed mesh.
806
     // Synthesizes intermediate points to produce a more detailed mesh.
836
   #define ABL_PROBE_PT_3_X 170
824
   #define ABL_PROBE_PT_3_X 170
837
   #define ABL_PROBE_PT_3_Y 20
825
   #define ABL_PROBE_PT_3_Y 20
838
 
826
 
839
-#endif
827
+#elif ENABLED(MESH_BED_LEVELING)
828
+
829
+//===========================================================================
830
+//=================================== Mesh ==================================
831
+//===========================================================================
832
+
833
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
834
+  #define MESH_INSET 10          // Mesh inset margin on print area
835
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
836
+  #define MESH_NUM_Y_POINTS 3
837
+
838
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
839
+
840
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
841
+
842
+  #if ENABLED(MANUAL_BED_LEVELING)
843
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
844
+  #endif  // MANUAL_BED_LEVELING
845
+
846
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
847
+
848
+//===========================================================================
849
+//========================= Unified Bed Leveling ============================
850
+//===========================================================================
851
+
852
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
853
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
854
+  #define UBL_MESH_NUM_Y_POINTS 10
855
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
856
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
857
+  #define UBL_PROBE_PT_2_X 39
858
+  #define UBL_PROBE_PT_2_Y 20
859
+  #define UBL_PROBE_PT_3_X 180
860
+  #define UBL_PROBE_PT_3_Y 20
861
+
862
+#endif  // BED_LEVELING
840
 
863
 
841
 /**
864
 /**
842
  * Commands to execute at the end of G29 probing.
865
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/Hephestos/Configuration.h Просмотреть файл

234
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
234
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
235
  *    66 : 4.7M High Temperature thermistor from Dyze Design
235
  *    66 : 4.7M High Temperature thermistor from Dyze Design
236
  *    70 : the 100K thermistor found in the bq Hephestos 2
236
  *    70 : the 100K thermistor found in the bq Hephestos 2
237
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
237
  *
238
  *
238
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
239
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
239
  *                              (but gives greater accuracy and more stable PID)
240
  *                              (but gives greater accuracy and more stable PID)
595
 //
596
 //
596
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
597
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
597
 //
598
 //
598
-// For a servo-based Z probe, you must set up servo support below, including
599
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
599
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
600
 //
600
 //
601
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
601
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
602
 // - Use 5V for powered (usu. inductive) sensors.
602
 // - Use 5V for powered (usu. inductive) sensors.
733
   #define FILAMENT_RUNOUT_SCRIPT "M600"
733
   #define FILAMENT_RUNOUT_SCRIPT "M600"
734
 #endif
734
 #endif
735
 
735
 
736
-//===========================================================================
737
-//============================ Mesh Bed Leveling ============================
738
-//===========================================================================
739
-
740
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
741
-
742
-#if ENABLED(MESH_BED_LEVELING)
743
-  #define MESH_INSET 10        // Mesh inset margin on print area
744
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
745
-  #define MESH_NUM_Y_POINTS 3
746
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
747
-
748
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
749
-
750
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
751
-
752
-  #if ENABLED(MANUAL_BED_LEVELING)
753
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
754
-  #endif  // MANUAL_BED_LEVELING
755
-
756
-  // Gradually reduce leveling correction until a set height is reached,
757
-  // at which point movement will be level to the machine's XY plane.
758
-  // The height can be set with M420 Z<height>
759
-  #define ENABLE_LEVELING_FADE_HEIGHT
760
-
761
-#endif  // MESH_BED_LEVELING
762
 
736
 
763
 //===========================================================================
737
 //===========================================================================
764
-//============================ Auto Bed Leveling ============================
738
+//=============================== Bed Leveling ==============================
765
 //===========================================================================
739
 //===========================================================================
766
 // @section bedlevel
740
 // @section bedlevel
767
 
741
 
785
  *   Probe several points in a grid.
759
  *   Probe several points in a grid.
786
  *   You specify the rectangle and the density of sample points.
760
  *   You specify the rectangle and the density of sample points.
787
  *   The result is a mesh, best for large or uneven beds.
761
  *   The result is a mesh, best for large or uneven beds.
762
+ *
763
+ * - UBL Unified Bed Leveling
764
+ *   A comprehensive bed leveling system that combines features and benefits from previous
765
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
766
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
767
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
768
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
769
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
770
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
771
+ *       test on.
788
  */
772
  */
789
 //#define AUTO_BED_LEVELING_3POINT
773
 //#define AUTO_BED_LEVELING_3POINT
790
 //#define AUTO_BED_LEVELING_LINEAR
774
 //#define AUTO_BED_LEVELING_LINEAR
791
 //#define AUTO_BED_LEVELING_BILINEAR
775
 //#define AUTO_BED_LEVELING_BILINEAR
776
+//#define MESH_BED_LEVELING
777
+//#define AUTO_BED_LEVELING_UBL
792
 
778
 
793
 /**
779
 /**
794
  * Enable detailed logging of G28, G29, M48, etc.
780
  * Enable detailed logging of G28, G29, M48, etc.
797
  */
783
  */
798
 //#define DEBUG_LEVELING_FEATURE
784
 //#define DEBUG_LEVELING_FEATURE
799
 
785
 
786
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
787
+  // Gradually reduce leveling correction until a set height is reached,
788
+  // at which point movement will be level to the machine's XY plane.
789
+  // The height can be set with M420 Z<height>
790
+  #define ENABLE_LEVELING_FADE_HEIGHT
791
+#endif
792
+
800
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
793
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 
794
 
802
   // Set the number of grid points per dimension.
795
   // Set the number of grid points per dimension.
817
 
810
 
818
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
 
812
 
820
-    // Gradually reduce leveling correction until a set height is reached,
821
-    // at which point movement will be level to the machine's XY plane.
822
-    // The height can be set with M420 Z<height>
823
-    #define ENABLE_LEVELING_FADE_HEIGHT
824
-
825
     //
813
     //
826
     // Experimental Subdivision of the grid by Catmull-Rom method.
814
     // Experimental Subdivision of the grid by Catmull-Rom method.
827
     // Synthesizes intermediate points to produce a more detailed mesh.
815
     // Synthesizes intermediate points to produce a more detailed mesh.
845
   #define ABL_PROBE_PT_3_X 170
833
   #define ABL_PROBE_PT_3_X 170
846
   #define ABL_PROBE_PT_3_Y 20
834
   #define ABL_PROBE_PT_3_Y 20
847
 
835
 
848
-#endif
836
+#elif ENABLED(MESH_BED_LEVELING)
837
+
838
+//===========================================================================
839
+//=================================== Mesh ==================================
840
+//===========================================================================
841
+
842
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
843
+  #define MESH_INSET 10          // Mesh inset margin on print area
844
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
845
+  #define MESH_NUM_Y_POINTS 3
846
+
847
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
848
+
849
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
850
+
851
+  #if ENABLED(MANUAL_BED_LEVELING)
852
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
853
+  #endif  // MANUAL_BED_LEVELING
854
+
855
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
856
+
857
+//===========================================================================
858
+//========================= Unified Bed Leveling ============================
859
+//===========================================================================
860
+
861
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
862
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
863
+  #define UBL_MESH_NUM_Y_POINTS 10
864
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
865
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
866
+  #define UBL_PROBE_PT_2_X 39
867
+  #define UBL_PROBE_PT_2_Y 20
868
+  #define UBL_PROBE_PT_3_X 180
869
+  #define UBL_PROBE_PT_3_Y 20
870
+
871
+#endif  // BED_LEVELING
849
 
872
 
850
 /**
873
 /**
851
  * Commands to execute at the end of G29 probing.
874
  * Commands to execute at the end of G29 probing.

+ 59
- 36
Marlin/example_configurations/Hephestos_2/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
597
 //
598
 //
598
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
599
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
599
 //
600
 //
600
-// For a servo-based Z probe, you must set up servo support below, including
601
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
601
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
602
 //
602
 //
603
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
603
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
604
 // - Use 5V for powered (usu. inductive) sensors.
604
 // - Use 5V for powered (usu. inductive) sensors.
735
   #define FILAMENT_RUNOUT_SCRIPT "M600"
735
   #define FILAMENT_RUNOUT_SCRIPT "M600"
736
 #endif
736
 #endif
737
 
737
 
738
-//===========================================================================
739
-//============================ Mesh Bed Leveling ============================
740
-//===========================================================================
741
-
742
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
743
-
744
-#if ENABLED(MESH_BED_LEVELING)
745
-  #define MESH_INSET 10        // Mesh inset margin on print area
746
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
747
-  #define MESH_NUM_Y_POINTS 3
748
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
749
-
750
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
751
-
752
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
753
-
754
-  #if ENABLED(MANUAL_BED_LEVELING)
755
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
756
-  #endif  // MANUAL_BED_LEVELING
757
-
758
-  // Gradually reduce leveling correction until a set height is reached,
759
-  // at which point movement will be level to the machine's XY plane.
760
-  // The height can be set with M420 Z<height>
761
-  #define ENABLE_LEVELING_FADE_HEIGHT
762
-
763
-#endif  // MESH_BED_LEVELING
764
 
738
 
765
 //===========================================================================
739
 //===========================================================================
766
-//============================ Auto Bed Leveling ============================
740
+//=============================== Bed Leveling ==============================
767
 //===========================================================================
741
 //===========================================================================
768
 // @section bedlevel
742
 // @section bedlevel
769
 
743
 
787
  *   Probe several points in a grid.
761
  *   Probe several points in a grid.
788
  *   You specify the rectangle and the density of sample points.
762
  *   You specify the rectangle and the density of sample points.
789
  *   The result is a mesh, best for large or uneven beds.
763
  *   The result is a mesh, best for large or uneven beds.
764
+ *
765
+ * - UBL Unified Bed Leveling
766
+ *   A comprehensive bed leveling system that combines features and benefits from previous
767
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
768
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
769
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
770
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
771
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
772
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
773
+ *       test on.
790
  */
774
  */
791
 //#define AUTO_BED_LEVELING_3POINT
775
 //#define AUTO_BED_LEVELING_3POINT
792
-#define AUTO_BED_LEVELING_LINEAR
776
+//#define AUTO_BED_LEVELING_LINEAR
793
 //#define AUTO_BED_LEVELING_BILINEAR
777
 //#define AUTO_BED_LEVELING_BILINEAR
778
+//#define MESH_BED_LEVELING
779
+//#define AUTO_BED_LEVELING_UBL
794
 
780
 
795
 /**
781
 /**
796
  * Enable detailed logging of G28, G29, M48, etc.
782
  * Enable detailed logging of G28, G29, M48, etc.
799
  */
785
  */
800
 //#define DEBUG_LEVELING_FEATURE
786
 //#define DEBUG_LEVELING_FEATURE
801
 
787
 
788
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
789
+  // Gradually reduce leveling correction until a set height is reached,
790
+  // at which point movement will be level to the machine's XY plane.
791
+  // The height can be set with M420 Z<height>
792
+  #define ENABLE_LEVELING_FADE_HEIGHT
793
+#endif
794
+
802
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
795
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
803
 
796
 
804
   // Set the number of grid points per dimension.
797
   // Set the number of grid points per dimension.
819
 
812
 
820
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
813
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
821
 
814
 
822
-    // Gradually reduce leveling correction until a set height is reached,
823
-    // at which point movement will be level to the machine's XY plane.
824
-    // The height can be set with M420 Z<height>
825
-    #define ENABLE_LEVELING_FADE_HEIGHT
826
-
827
     //
815
     //
828
     // Experimental Subdivision of the grid by Catmull-Rom method.
816
     // Experimental Subdivision of the grid by Catmull-Rom method.
829
     // Synthesizes intermediate points to produce a more detailed mesh.
817
     // Synthesizes intermediate points to produce a more detailed mesh.
847
   #define ABL_PROBE_PT_3_X ((X_MIN_POS + X_MAX_POS) / 2)
835
   #define ABL_PROBE_PT_3_X ((X_MIN_POS + X_MAX_POS) / 2)
848
   #define ABL_PROBE_PT_3_Y Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
836
   #define ABL_PROBE_PT_3_Y Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
849
 
837
 
850
-#endif
838
+#elif ENABLED(MESH_BED_LEVELING)
839
+
840
+//===========================================================================
841
+//=================================== Mesh ==================================
842
+//===========================================================================
843
+
844
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
845
+  #define MESH_INSET 10          // Mesh inset margin on print area
846
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
847
+  #define MESH_NUM_Y_POINTS 3
848
+
849
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
850
+
851
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
852
+
853
+  #if ENABLED(MANUAL_BED_LEVELING)
854
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
855
+  #endif  // MANUAL_BED_LEVELING
856
+
857
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
858
+
859
+//===========================================================================
860
+//========================= Unified Bed Leveling ============================
861
+//===========================================================================
862
+
863
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
864
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
865
+  #define UBL_MESH_NUM_Y_POINTS 10
866
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
867
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
868
+  #define UBL_PROBE_PT_2_X 39
869
+  #define UBL_PROBE_PT_2_Y 20
870
+  #define UBL_PROBE_PT_3_X 180
871
+  #define UBL_PROBE_PT_3_Y 20
872
+
873
+#endif  // BED_LEVELING
851
 
874
 
852
 /**
875
 /**
853
  * Commands to execute at the end of G29 probing.
876
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/K8200/Configuration.h Просмотреть файл

251
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
251
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
252
  *    66 : 4.7M High Temperature thermistor from Dyze Design
252
  *    66 : 4.7M High Temperature thermistor from Dyze Design
253
  *    70 : the 100K thermistor found in the bq Hephestos 2
253
  *    70 : the 100K thermistor found in the bq Hephestos 2
254
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
254
  *
255
  *
255
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
256
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
256
  *                              (but gives greater accuracy and more stable PID)
257
  *                              (but gives greater accuracy and more stable PID)
632
 //
633
 //
633
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
634
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
634
 //
635
 //
635
-// For a servo-based Z probe, you must set up servo support below, including
636
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
636
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
637
 //
637
 //
638
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
638
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
639
 // - Use 5V for powered (usu. inductive) sensors.
639
 // - Use 5V for powered (usu. inductive) sensors.
770
   #define FILAMENT_RUNOUT_SCRIPT "M600"
770
   #define FILAMENT_RUNOUT_SCRIPT "M600"
771
 #endif
771
 #endif
772
 
772
 
773
-//===========================================================================
774
-//============================ Mesh Bed Leveling ============================
775
-//===========================================================================
776
-
777
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
778
-
779
-#if ENABLED(MESH_BED_LEVELING)
780
-  #define MESH_INSET 10        // Mesh inset margin on print area
781
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
782
-  #define MESH_NUM_Y_POINTS 3
783
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
784
-
785
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
786
-
787
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
788
-
789
-  #if ENABLED(MANUAL_BED_LEVELING)
790
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
791
-  #endif  // MANUAL_BED_LEVELING
792
-
793
-  // Gradually reduce leveling correction until a set height is reached,
794
-  // at which point movement will be level to the machine's XY plane.
795
-  // The height can be set with M420 Z<height>
796
-  #define ENABLE_LEVELING_FADE_HEIGHT
797
-
798
-#endif  // MESH_BED_LEVELING
799
 
773
 
800
 //===========================================================================
774
 //===========================================================================
801
-//============================ Auto Bed Leveling ============================
775
+//=============================== Bed Leveling ==============================
802
 //===========================================================================
776
 //===========================================================================
803
 // @section bedlevel
777
 // @section bedlevel
804
 
778
 
822
  *   Probe several points in a grid.
796
  *   Probe several points in a grid.
823
  *   You specify the rectangle and the density of sample points.
797
  *   You specify the rectangle and the density of sample points.
824
  *   The result is a mesh, best for large or uneven beds.
798
  *   The result is a mesh, best for large or uneven beds.
799
+ *
800
+ * - UBL Unified Bed Leveling
801
+ *   A comprehensive bed leveling system that combines features and benefits from previous
802
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
803
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
804
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
805
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
806
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
807
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
808
+ *       test on.
825
  */
809
  */
826
 //#define AUTO_BED_LEVELING_3POINT
810
 //#define AUTO_BED_LEVELING_3POINT
827
 //#define AUTO_BED_LEVELING_LINEAR
811
 //#define AUTO_BED_LEVELING_LINEAR
828
 //#define AUTO_BED_LEVELING_BILINEAR
812
 //#define AUTO_BED_LEVELING_BILINEAR
813
+//#define MESH_BED_LEVELING
814
+//#define AUTO_BED_LEVELING_UBL
829
 
815
 
830
 /**
816
 /**
831
  * Enable detailed logging of G28, G29, M48, etc.
817
  * Enable detailed logging of G28, G29, M48, etc.
834
  */
820
  */
835
 //#define DEBUG_LEVELING_FEATURE
821
 //#define DEBUG_LEVELING_FEATURE
836
 
822
 
823
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
824
+  // Gradually reduce leveling correction until a set height is reached,
825
+  // at which point movement will be level to the machine's XY plane.
826
+  // The height can be set with M420 Z<height>
827
+  #define ENABLE_LEVELING_FADE_HEIGHT
828
+#endif
829
+
837
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
830
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
838
 
831
 
839
   // Set the number of grid points per dimension.
832
   // Set the number of grid points per dimension.
854
 
847
 
855
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
848
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
856
 
849
 
857
-    // Gradually reduce leveling correction until a set height is reached,
858
-    // at which point movement will be level to the machine's XY plane.
859
-    // The height can be set with M420 Z<height>
860
-    #define ENABLE_LEVELING_FADE_HEIGHT
861
-
862
     //
850
     //
863
     // Experimental Subdivision of the grid by Catmull-Rom method.
851
     // Experimental Subdivision of the grid by Catmull-Rom method.
864
     // Synthesizes intermediate points to produce a more detailed mesh.
852
     // Synthesizes intermediate points to produce a more detailed mesh.
882
   #define ABL_PROBE_PT_3_X 170
870
   #define ABL_PROBE_PT_3_X 170
883
   #define ABL_PROBE_PT_3_Y 20
871
   #define ABL_PROBE_PT_3_Y 20
884
 
872
 
885
-#endif
873
+#elif ENABLED(MESH_BED_LEVELING)
874
+
875
+//===========================================================================
876
+//=================================== Mesh ==================================
877
+//===========================================================================
878
+
879
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
880
+  #define MESH_INSET 10          // Mesh inset margin on print area
881
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
882
+  #define MESH_NUM_Y_POINTS 3
883
+
884
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
885
+
886
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
887
+
888
+  #if ENABLED(MANUAL_BED_LEVELING)
889
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
890
+  #endif  // MANUAL_BED_LEVELING
891
+
892
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
893
+
894
+//===========================================================================
895
+//========================= Unified Bed Leveling ============================
896
+//===========================================================================
897
+
898
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
899
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
900
+  #define UBL_MESH_NUM_Y_POINTS 10
901
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
902
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
903
+  #define UBL_PROBE_PT_2_X 39
904
+  #define UBL_PROBE_PT_2_Y 20
905
+  #define UBL_PROBE_PT_3_X 180
906
+  #define UBL_PROBE_PT_3_Y 20
907
+
908
+#endif  // BED_LEVELING
886
 
909
 
887
 /**
910
 /**
888
  * Commands to execute at the end of G29 probing.
911
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/K8400/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
603
 //
604
 //
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 //
606
 //
606
-// For a servo-based Z probe, you must set up servo support below, including
607
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
607
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
608
 //
608
 //
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
610
 // - Use 5V for powered (usu. inductive) sensors.
610
 // - Use 5V for powered (usu. inductive) sensors.
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
742
 #endif
742
 #endif
743
 
743
 
744
-//===========================================================================
745
-//============================ Mesh Bed Leveling ============================
746
-//===========================================================================
747
-
748
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
749
-
750
-#if ENABLED(MESH_BED_LEVELING)
751
-  #define MESH_INSET 10        // Mesh inset margin on print area
752
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
753
-  #define MESH_NUM_Y_POINTS 3
754
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
755
-
756
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
757
-
758
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
759
-
760
-  #if ENABLED(MANUAL_BED_LEVELING)
761
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
762
-  #endif  // MANUAL_BED_LEVELING
763
-
764
-  // Gradually reduce leveling correction until a set height is reached,
765
-  // at which point movement will be level to the machine's XY plane.
766
-  // The height can be set with M420 Z<height>
767
-  #define ENABLE_LEVELING_FADE_HEIGHT
768
-
769
-#endif  // MESH_BED_LEVELING
770
 
744
 
771
 //===========================================================================
745
 //===========================================================================
772
-//============================ Auto Bed Leveling ============================
746
+//=============================== Bed Leveling ==============================
773
 //===========================================================================
747
 //===========================================================================
774
 // @section bedlevel
748
 // @section bedlevel
775
 
749
 
793
  *   Probe several points in a grid.
767
  *   Probe several points in a grid.
794
  *   You specify the rectangle and the density of sample points.
768
  *   You specify the rectangle and the density of sample points.
795
  *   The result is a mesh, best for large or uneven beds.
769
  *   The result is a mesh, best for large or uneven beds.
770
+ *
771
+ * - UBL Unified Bed Leveling
772
+ *   A comprehensive bed leveling system that combines features and benefits from previous
773
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
774
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
775
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
776
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
777
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
778
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
779
+ *       test on.
796
  */
780
  */
797
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_3POINT
798
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_LINEAR
799
 //#define AUTO_BED_LEVELING_BILINEAR
783
 //#define AUTO_BED_LEVELING_BILINEAR
784
+//#define MESH_BED_LEVELING
785
+//#define AUTO_BED_LEVELING_UBL
800
 
786
 
801
 /**
787
 /**
802
  * Enable detailed logging of G28, G29, M48, etc.
788
  * Enable detailed logging of G28, G29, M48, etc.
805
  */
791
  */
806
 //#define DEBUG_LEVELING_FEATURE
792
 //#define DEBUG_LEVELING_FEATURE
807
 
793
 
794
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
795
+  // Gradually reduce leveling correction until a set height is reached,
796
+  // at which point movement will be level to the machine's XY plane.
797
+  // The height can be set with M420 Z<height>
798
+  #define ENABLE_LEVELING_FADE_HEIGHT
799
+#endif
800
+
808
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
 
802
 
810
   // Set the number of grid points per dimension.
803
   // Set the number of grid points per dimension.
825
 
818
 
826
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
827
 
820
 
828
-    // Gradually reduce leveling correction until a set height is reached,
829
-    // at which point movement will be level to the machine's XY plane.
830
-    // The height can be set with M420 Z<height>
831
-    #define ENABLE_LEVELING_FADE_HEIGHT
832
-
833
     //
821
     //
834
     // Experimental Subdivision of the grid by Catmull-Rom method.
822
     // Experimental Subdivision of the grid by Catmull-Rom method.
835
     // Synthesizes intermediate points to produce a more detailed mesh.
823
     // Synthesizes intermediate points to produce a more detailed mesh.
853
   #define ABL_PROBE_PT_3_X 170
841
   #define ABL_PROBE_PT_3_X 170
854
   #define ABL_PROBE_PT_3_Y 20
842
   #define ABL_PROBE_PT_3_Y 20
855
 
843
 
856
-#endif
844
+#elif ENABLED(MESH_BED_LEVELING)
845
+
846
+//===========================================================================
847
+//=================================== Mesh ==================================
848
+//===========================================================================
849
+
850
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
851
+  #define MESH_INSET 10          // Mesh inset margin on print area
852
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
853
+  #define MESH_NUM_Y_POINTS 3
854
+
855
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
856
+
857
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
858
+
859
+  #if ENABLED(MANUAL_BED_LEVELING)
860
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
861
+  #endif  // MANUAL_BED_LEVELING
862
+
863
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
864
+
865
+//===========================================================================
866
+//========================= Unified Bed Leveling ============================
867
+//===========================================================================
868
+
869
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
870
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
871
+  #define UBL_MESH_NUM_Y_POINTS 10
872
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
873
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
874
+  #define UBL_PROBE_PT_2_X 39
875
+  #define UBL_PROBE_PT_2_Y 20
876
+  #define UBL_PROBE_PT_3_X 180
877
+  #define UBL_PROBE_PT_3_Y 20
878
+
879
+#endif  // BED_LEVELING
857
 
880
 
858
 /**
881
 /**
859
  * Commands to execute at the end of G29 probing.
882
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/K8400/Dual-head/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
603
 //
604
 //
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 //
606
 //
606
-// For a servo-based Z probe, you must set up servo support below, including
607
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
607
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
608
 //
608
 //
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
610
 // - Use 5V for powered (usu. inductive) sensors.
610
 // - Use 5V for powered (usu. inductive) sensors.
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
742
 #endif
742
 #endif
743
 
743
 
744
-//===========================================================================
745
-//============================ Mesh Bed Leveling ============================
746
-//===========================================================================
747
-
748
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
749
-
750
-#if ENABLED(MESH_BED_LEVELING)
751
-  #define MESH_INSET 10        // Mesh inset margin on print area
752
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
753
-  #define MESH_NUM_Y_POINTS 3
754
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
755
-
756
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
757
-
758
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
759
-
760
-  #if ENABLED(MANUAL_BED_LEVELING)
761
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
762
-  #endif  // MANUAL_BED_LEVELING
763
-
764
-  // Gradually reduce leveling correction until a set height is reached,
765
-  // at which point movement will be level to the machine's XY plane.
766
-  // The height can be set with M420 Z<height>
767
-  #define ENABLE_LEVELING_FADE_HEIGHT
768
-
769
-#endif  // MESH_BED_LEVELING
770
 
744
 
771
 //===========================================================================
745
 //===========================================================================
772
-//============================ Auto Bed Leveling ============================
746
+//=============================== Bed Leveling ==============================
773
 //===========================================================================
747
 //===========================================================================
774
 // @section bedlevel
748
 // @section bedlevel
775
 
749
 
793
  *   Probe several points in a grid.
767
  *   Probe several points in a grid.
794
  *   You specify the rectangle and the density of sample points.
768
  *   You specify the rectangle and the density of sample points.
795
  *   The result is a mesh, best for large or uneven beds.
769
  *   The result is a mesh, best for large or uneven beds.
770
+ *
771
+ * - UBL Unified Bed Leveling
772
+ *   A comprehensive bed leveling system that combines features and benefits from previous
773
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
774
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
775
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
776
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
777
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
778
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
779
+ *       test on.
796
  */
780
  */
797
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_3POINT
798
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_LINEAR
799
 //#define AUTO_BED_LEVELING_BILINEAR
783
 //#define AUTO_BED_LEVELING_BILINEAR
784
+//#define MESH_BED_LEVELING
785
+//#define AUTO_BED_LEVELING_UBL
800
 
786
 
801
 /**
787
 /**
802
  * Enable detailed logging of G28, G29, M48, etc.
788
  * Enable detailed logging of G28, G29, M48, etc.
805
  */
791
  */
806
 //#define DEBUG_LEVELING_FEATURE
792
 //#define DEBUG_LEVELING_FEATURE
807
 
793
 
794
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
795
+  // Gradually reduce leveling correction until a set height is reached,
796
+  // at which point movement will be level to the machine's XY plane.
797
+  // The height can be set with M420 Z<height>
798
+  #define ENABLE_LEVELING_FADE_HEIGHT
799
+#endif
800
+
808
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
 
802
 
810
   // Set the number of grid points per dimension.
803
   // Set the number of grid points per dimension.
825
 
818
 
826
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
827
 
820
 
828
-    // Gradually reduce leveling correction until a set height is reached,
829
-    // at which point movement will be level to the machine's XY plane.
830
-    // The height can be set with M420 Z<height>
831
-    #define ENABLE_LEVELING_FADE_HEIGHT
832
-
833
     //
821
     //
834
     // Experimental Subdivision of the grid by Catmull-Rom method.
822
     // Experimental Subdivision of the grid by Catmull-Rom method.
835
     // Synthesizes intermediate points to produce a more detailed mesh.
823
     // Synthesizes intermediate points to produce a more detailed mesh.
853
   #define ABL_PROBE_PT_3_X 170
841
   #define ABL_PROBE_PT_3_X 170
854
   #define ABL_PROBE_PT_3_Y 20
842
   #define ABL_PROBE_PT_3_Y 20
855
 
843
 
856
-#endif
844
+#elif ENABLED(MESH_BED_LEVELING)
845
+
846
+//===========================================================================
847
+//=================================== Mesh ==================================
848
+//===========================================================================
849
+
850
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
851
+  #define MESH_INSET 10          // Mesh inset margin on print area
852
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
853
+  #define MESH_NUM_Y_POINTS 3
854
+
855
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
856
+
857
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
858
+
859
+  #if ENABLED(MANUAL_BED_LEVELING)
860
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
861
+  #endif  // MANUAL_BED_LEVELING
862
+
863
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
864
+
865
+//===========================================================================
866
+//========================= Unified Bed Leveling ============================
867
+//===========================================================================
868
+
869
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
870
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
871
+  #define UBL_MESH_NUM_Y_POINTS 10
872
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
873
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
874
+  #define UBL_PROBE_PT_2_X 39
875
+  #define UBL_PROBE_PT_2_Y 20
876
+  #define UBL_PROBE_PT_3_X 180
877
+  #define UBL_PROBE_PT_3_Y 20
878
+
879
+#endif  // BED_LEVELING
857
 
880
 
858
 /**
881
 /**
859
  * Commands to execute at the end of G29 probing.
882
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
603
 //
604
 //
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 //
606
 //
606
-// For a servo-based Z probe, you must set up servo support below, including
607
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
607
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
608
 //
608
 //
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
610
 // - Use 5V for powered (usu. inductive) sensors.
610
 // - Use 5V for powered (usu. inductive) sensors.
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
742
 #endif
742
 #endif
743
 
743
 
744
-//===========================================================================
745
-//============================ Mesh Bed Leveling ============================
746
-//===========================================================================
747
-
748
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
749
-
750
-#if ENABLED(MESH_BED_LEVELING)
751
-  #define MESH_INSET 10        // Mesh inset margin on print area
752
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
753
-  #define MESH_NUM_Y_POINTS 3
754
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
755
-
756
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
757
-
758
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
759
-
760
-  #if ENABLED(MANUAL_BED_LEVELING)
761
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
762
-  #endif  // MANUAL_BED_LEVELING
763
-
764
-  // Gradually reduce leveling correction until a set height is reached,
765
-  // at which point movement will be level to the machine's XY plane.
766
-  // The height can be set with M420 Z<height>
767
-  #define ENABLE_LEVELING_FADE_HEIGHT
768
-
769
-#endif  // MESH_BED_LEVELING
770
 
744
 
771
 //===========================================================================
745
 //===========================================================================
772
-//============================ Auto Bed Leveling ============================
746
+//=============================== Bed Leveling ==============================
773
 //===========================================================================
747
 //===========================================================================
774
 // @section bedlevel
748
 // @section bedlevel
775
 
749
 
793
  *   Probe several points in a grid.
767
  *   Probe several points in a grid.
794
  *   You specify the rectangle and the density of sample points.
768
  *   You specify the rectangle and the density of sample points.
795
  *   The result is a mesh, best for large or uneven beds.
769
  *   The result is a mesh, best for large or uneven beds.
770
+ *
771
+ * - UBL Unified Bed Leveling
772
+ *   A comprehensive bed leveling system that combines features and benefits from previous
773
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
774
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
775
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
776
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
777
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
778
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
779
+ *       test on.
796
  */
780
  */
797
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_3POINT
798
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_LINEAR
799
 //#define AUTO_BED_LEVELING_BILINEAR
783
 //#define AUTO_BED_LEVELING_BILINEAR
784
+//#define MESH_BED_LEVELING
785
+//#define AUTO_BED_LEVELING_UBL
800
 
786
 
801
 /**
787
 /**
802
  * Enable detailed logging of G28, G29, M48, etc.
788
  * Enable detailed logging of G28, G29, M48, etc.
805
  */
791
  */
806
 //#define DEBUG_LEVELING_FEATURE
792
 //#define DEBUG_LEVELING_FEATURE
807
 
793
 
794
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
795
+  // Gradually reduce leveling correction until a set height is reached,
796
+  // at which point movement will be level to the machine's XY plane.
797
+  // The height can be set with M420 Z<height>
798
+  #define ENABLE_LEVELING_FADE_HEIGHT
799
+#endif
800
+
808
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
 
802
 
810
   // Set the number of grid points per dimension.
803
   // Set the number of grid points per dimension.
825
 
818
 
826
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
827
 
820
 
828
-    // Gradually reduce leveling correction until a set height is reached,
829
-    // at which point movement will be level to the machine's XY plane.
830
-    // The height can be set with M420 Z<height>
831
-    #define ENABLE_LEVELING_FADE_HEIGHT
832
-
833
     //
821
     //
834
     // Experimental Subdivision of the grid by Catmull-Rom method.
822
     // Experimental Subdivision of the grid by Catmull-Rom method.
835
     // Synthesizes intermediate points to produce a more detailed mesh.
823
     // Synthesizes intermediate points to produce a more detailed mesh.
853
   #define ABL_PROBE_PT_3_X 170
841
   #define ABL_PROBE_PT_3_X 170
854
   #define ABL_PROBE_PT_3_Y 20
842
   #define ABL_PROBE_PT_3_Y 20
855
 
843
 
856
-#endif
844
+#elif ENABLED(MESH_BED_LEVELING)
845
+
846
+//===========================================================================
847
+//=================================== Mesh ==================================
848
+//===========================================================================
849
+
850
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
851
+  #define MESH_INSET 10          // Mesh inset margin on print area
852
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
853
+  #define MESH_NUM_Y_POINTS 3
854
+
855
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
856
+
857
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
858
+
859
+  #if ENABLED(MANUAL_BED_LEVELING)
860
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
861
+  #endif  // MANUAL_BED_LEVELING
862
+
863
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
864
+
865
+//===========================================================================
866
+//========================= Unified Bed Leveling ============================
867
+//===========================================================================
868
+
869
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
870
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
871
+  #define UBL_MESH_NUM_Y_POINTS 10
872
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
873
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
874
+  #define UBL_PROBE_PT_2_X 39
875
+  #define UBL_PROBE_PT_2_Y 20
876
+  #define UBL_PROBE_PT_3_X 180
877
+  #define UBL_PROBE_PT_3_Y 20
878
+
879
+#endif  // BED_LEVELING
857
 
880
 
858
 /**
881
 /**
859
  * Commands to execute at the end of G29 probing.
882
  * Commands to execute at the end of G29 probing.

+ 59
- 36
Marlin/example_configurations/RigidBot/Configuration.h Просмотреть файл

234
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
234
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
235
  *    66 : 4.7M High Temperature thermistor from Dyze Design
235
  *    66 : 4.7M High Temperature thermistor from Dyze Design
236
  *    70 : the 100K thermistor found in the bq Hephestos 2
236
  *    70 : the 100K thermistor found in the bq Hephestos 2
237
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
237
  *
238
  *
238
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
239
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
239
  *                              (but gives greater accuracy and more stable PID)
240
  *                              (but gives greater accuracy and more stable PID)
602
 //
603
 //
603
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
604
 //
605
 //
605
-// For a servo-based Z probe, you must set up servo support below, including
606
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
606
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
607
 //
607
 //
608
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
608
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - Use 5V for powered (usu. inductive) sensors.
609
 // - Use 5V for powered (usu. inductive) sensors.
740
   #define FILAMENT_RUNOUT_SCRIPT "M600"
740
   #define FILAMENT_RUNOUT_SCRIPT "M600"
741
 #endif
741
 #endif
742
 
742
 
743
-//===========================================================================
744
-//============================ Mesh Bed Leveling ============================
745
-//===========================================================================
746
-
747
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
748
-
749
-#if ENABLED(MESH_BED_LEVELING)
750
-  #define MESH_INSET 10        // Mesh inset margin on print area
751
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
752
-  #define MESH_NUM_Y_POINTS 3
753
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
754
-
755
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
756
-
757
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
758
-
759
-  #if ENABLED(MANUAL_BED_LEVELING)
760
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
761
-  #endif  // MANUAL_BED_LEVELING
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
-
768
-#endif  // MESH_BED_LEVELING
769
 
743
 
770
 //===========================================================================
744
 //===========================================================================
771
-//============================ Auto Bed Leveling ============================
745
+//=============================== Bed Leveling ==============================
772
 //===========================================================================
746
 //===========================================================================
773
 // @section bedlevel
747
 // @section bedlevel
774
 
748
 
792
  *   Probe several points in a grid.
766
  *   Probe several points in a grid.
793
  *   You specify the rectangle and the density of sample points.
767
  *   You specify the rectangle and the density of sample points.
794
  *   The result is a mesh, best for large or uneven beds.
768
  *   The result is a mesh, best for large or uneven beds.
769
+ *
770
+ * - UBL Unified Bed Leveling
771
+ *   A comprehensive bed leveling system that combines features and benefits from previous
772
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
773
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
774
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
775
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
776
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
777
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
778
+ *       test on.
795
  */
779
  */
796
 //#define AUTO_BED_LEVELING_3POINT
780
 //#define AUTO_BED_LEVELING_3POINT
797
 //#define AUTO_BED_LEVELING_LINEAR
781
 //#define AUTO_BED_LEVELING_LINEAR
798
 //#define AUTO_BED_LEVELING_BILINEAR
782
 //#define AUTO_BED_LEVELING_BILINEAR
783
+//#define MESH_BED_LEVELING
784
+//#define AUTO_BED_LEVELING_UBL
799
 
785
 
800
 /**
786
 /**
801
  * Enable detailed logging of G28, G29, M48, etc.
787
  * Enable detailed logging of G28, G29, M48, etc.
804
  */
790
  */
805
 //#define DEBUG_LEVELING_FEATURE
791
 //#define DEBUG_LEVELING_FEATURE
806
 
792
 
793
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
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
+
807
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
800
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
808
 
801
 
809
   // Set the number of grid points per dimension.
802
   // Set the number of grid points per dimension.
824
 
817
 
825
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
818
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
826
 
819
 
827
-    // Gradually reduce leveling correction until a set height is reached,
828
-    // at which point movement will be level to the machine's XY plane.
829
-    // The height can be set with M420 Z<height>
830
-    #define ENABLE_LEVELING_FADE_HEIGHT
831
-
832
     //
820
     //
833
     // Experimental Subdivision of the grid by Catmull-Rom method.
821
     // Experimental Subdivision of the grid by Catmull-Rom method.
834
     // Synthesizes intermediate points to produce a more detailed mesh.
822
     // Synthesizes intermediate points to produce a more detailed mesh.
852
   #define ABL_PROBE_PT_3_X 170
840
   #define ABL_PROBE_PT_3_X 170
853
   #define ABL_PROBE_PT_3_Y 20
841
   #define ABL_PROBE_PT_3_Y 20
854
 
842
 
855
-#endif
843
+#elif ENABLED(MESH_BED_LEVELING)
844
+
845
+//===========================================================================
846
+//=================================== Mesh ==================================
847
+//===========================================================================
848
+
849
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
850
+  #define MESH_INSET 10          // Mesh inset margin on print area
851
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
852
+  #define MESH_NUM_Y_POINTS 3
853
+
854
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
855
+
856
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
857
+
858
+  #if ENABLED(MANUAL_BED_LEVELING)
859
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
860
+  #endif  // MANUAL_BED_LEVELING
861
+
862
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
863
+
864
+//===========================================================================
865
+//========================= Unified Bed Leveling ============================
866
+//===========================================================================
867
+
868
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
869
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
870
+  #define UBL_MESH_NUM_Y_POINTS 10
871
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
872
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
873
+  #define UBL_PROBE_PT_2_X 39
874
+  #define UBL_PROBE_PT_2_Y 20
875
+  #define UBL_PROBE_PT_3_X 180
876
+  #define UBL_PROBE_PT_3_Y 20
877
+
878
+#endif  // BED_LEVELING
856
 
879
 
857
 /**
880
 /**
858
  * Commands to execute at the end of G29 probing.
881
  * Commands to execute at the end of G29 probing.
1434
 // leaving it undefined or defining as 0 will disable the servo subsystem
1457
 // leaving it undefined or defining as 0 will disable the servo subsystem
1435
 // If unsure, leave commented / disabled
1458
 // If unsure, leave commented / disabled
1436
 //
1459
 //
1437
-#define NUM_SERVOS 0 // DGlass3D - Servo index starts with 0 for M280 command
1460
+//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
1438
 
1461
 
1439
 // Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
1462
 // Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
1440
 // 300ms is a good value but you can try less delay.
1463
 // 300ms is a good value but you can try less delay.

+ 1503
- 0
Marlin/example_configurations/Roxys_printers/Folger_Tech_i3_2020/Configuration.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1091
- 0
Marlin/example_configurations/Roxys_printers/Folger_Tech_i3_2020/Configuration_adv.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1500
- 0
Marlin/example_configurations/Roxys_printers/gMax_1.5+/Configuration.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1085
- 0
Marlin/example_configurations/Roxys_printers/gMax_1.5+/Configuration_adv.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1505
- 0
Marlin/example_configurations/Roxys_printers/original_release_files/Configuration.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1085
- 0
Marlin/example_configurations/Roxys_printers/original_release_files/Configuration_adv.h
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 58
- 35
Marlin/example_configurations/SCARA/Configuration.h Просмотреть файл

263
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
263
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
264
  *    66 : 4.7M High Temperature thermistor from Dyze Design
264
  *    66 : 4.7M High Temperature thermistor from Dyze Design
265
  *    70 : the 100K thermistor found in the bq Hephestos 2
265
  *    70 : the 100K thermistor found in the bq Hephestos 2
266
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
266
  *
267
  *
267
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
268
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
268
  *                              (but gives greater accuracy and more stable PID)
269
  *                              (but gives greater accuracy and more stable PID)
618
 //
619
 //
619
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
620
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
620
 //
621
 //
621
-// For a servo-based Z probe, you must set up servo support below, including
622
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
622
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
623
 //
623
 //
624
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
624
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
625
 // - Use 5V for powered (usu. inductive) sensors.
625
 // - Use 5V for powered (usu. inductive) sensors.
756
   #define FILAMENT_RUNOUT_SCRIPT "M600"
756
   #define FILAMENT_RUNOUT_SCRIPT "M600"
757
 #endif
757
 #endif
758
 
758
 
759
-//===========================================================================
760
-//============================ Mesh Bed Leveling ============================
761
-//===========================================================================
762
-
763
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
764
-
765
-#if ENABLED(MESH_BED_LEVELING)
766
-  #define MESH_INSET 10        // Mesh inset margin on print area
767
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
768
-  #define MESH_NUM_Y_POINTS 3
769
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
770
-
771
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
772
-
773
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
774
-
775
-  #if ENABLED(MANUAL_BED_LEVELING)
776
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
777
-  #endif  // MANUAL_BED_LEVELING
778
-
779
-  // Gradually reduce leveling correction until a set height is reached,
780
-  // at which point movement will be level to the machine's XY plane.
781
-  // The height can be set with M420 Z<height>
782
-  #define ENABLE_LEVELING_FADE_HEIGHT
783
-
784
-#endif  // MESH_BED_LEVELING
785
 
759
 
786
 //===========================================================================
760
 //===========================================================================
787
-//============================ Auto Bed Leveling ============================
761
+//=============================== Bed Leveling ==============================
788
 //===========================================================================
762
 //===========================================================================
789
 // @section bedlevel
763
 // @section bedlevel
790
 
764
 
808
  *   Probe several points in a grid.
782
  *   Probe several points in a grid.
809
  *   You specify the rectangle and the density of sample points.
783
  *   You specify the rectangle and the density of sample points.
810
  *   The result is a mesh, best for large or uneven beds.
784
  *   The result is a mesh, best for large or uneven beds.
785
+ *
786
+ * - UBL Unified Bed Leveling
787
+ *   A comprehensive bed leveling system that combines features and benefits from previous
788
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
789
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
790
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
791
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
792
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
793
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
794
+ *       test on.
811
  */
795
  */
812
 //#define AUTO_BED_LEVELING_3POINT
796
 //#define AUTO_BED_LEVELING_3POINT
813
 //#define AUTO_BED_LEVELING_LINEAR
797
 //#define AUTO_BED_LEVELING_LINEAR
814
 //#define AUTO_BED_LEVELING_BILINEAR
798
 //#define AUTO_BED_LEVELING_BILINEAR
799
+//#define MESH_BED_LEVELING
800
+//#define AUTO_BED_LEVELING_UBL
815
 
801
 
816
 /**
802
 /**
817
  * Enable detailed logging of G28, G29, M48, etc.
803
  * Enable detailed logging of G28, G29, M48, etc.
820
  */
806
  */
821
 //#define DEBUG_LEVELING_FEATURE
807
 //#define DEBUG_LEVELING_FEATURE
822
 
808
 
809
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
810
+  // Gradually reduce leveling correction until a set height is reached,
811
+  // at which point movement will be level to the machine's XY plane.
812
+  // The height can be set with M420 Z<height>
813
+  #define ENABLE_LEVELING_FADE_HEIGHT
814
+#endif
815
+
823
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
816
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
824
 
817
 
825
   // Set the number of grid points per dimension.
818
   // Set the number of grid points per dimension.
840
 
833
 
841
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
834
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
842
 
835
 
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
-
848
     //
836
     //
849
     // Experimental Subdivision of the grid by Catmull-Rom method.
837
     // Experimental Subdivision of the grid by Catmull-Rom method.
850
     // Synthesizes intermediate points to produce a more detailed mesh.
838
     // Synthesizes intermediate points to produce a more detailed mesh.
868
   #define ABL_PROBE_PT_3_X 170
856
   #define ABL_PROBE_PT_3_X 170
869
   #define ABL_PROBE_PT_3_Y 20
857
   #define ABL_PROBE_PT_3_Y 20
870
 
858
 
871
-#endif
859
+#elif ENABLED(MESH_BED_LEVELING)
860
+
861
+//===========================================================================
862
+//=================================== Mesh ==================================
863
+//===========================================================================
864
+
865
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
866
+  #define MESH_INSET 10          // Mesh inset margin on print area
867
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
868
+  #define MESH_NUM_Y_POINTS 3
869
+
870
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
871
+
872
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
873
+
874
+  #if ENABLED(MANUAL_BED_LEVELING)
875
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
876
+  #endif  // MANUAL_BED_LEVELING
877
+
878
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
879
+
880
+//===========================================================================
881
+//========================= Unified Bed Leveling ============================
882
+//===========================================================================
883
+
884
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
885
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
886
+  #define UBL_MESH_NUM_Y_POINTS 10
887
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
888
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
889
+  #define UBL_PROBE_PT_2_X 39
890
+  #define UBL_PROBE_PT_2_Y 20
891
+  #define UBL_PROBE_PT_3_X 180
892
+  #define UBL_PROBE_PT_3_Y 20
893
+
894
+#endif  // BED_LEVELING
872
 
895
 
873
 /**
896
 /**
874
  * Commands to execute at the end of G29 probing.
897
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/TAZ4/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
624
 //
625
 //
625
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
626
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
626
 //
627
 //
627
-// For a servo-based Z probe, you must set up servo support below, including
628
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
628
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
629
 //
629
 //
630
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
630
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
631
 // - Use 5V for powered (usu. inductive) sensors.
631
 // - Use 5V for powered (usu. inductive) sensors.
762
   #define FILAMENT_RUNOUT_SCRIPT "M600"
762
   #define FILAMENT_RUNOUT_SCRIPT "M600"
763
 #endif
763
 #endif
764
 
764
 
765
-//===========================================================================
766
-//============================ Mesh Bed Leveling ============================
767
-//===========================================================================
768
-
769
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
770
-
771
-#if ENABLED(MESH_BED_LEVELING)
772
-  #define MESH_INSET 10        // Mesh inset margin on print area
773
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
774
-  #define MESH_NUM_Y_POINTS 3
775
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
776
-
777
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
778
-
779
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
780
-
781
-  #if ENABLED(MANUAL_BED_LEVELING)
782
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
783
-  #endif  // MANUAL_BED_LEVELING
784
-
785
-  // Gradually reduce leveling correction until a set height is reached,
786
-  // at which point movement will be level to the machine's XY plane.
787
-  // The height can be set with M420 Z<height>
788
-  #define ENABLE_LEVELING_FADE_HEIGHT
789
-
790
-#endif  // MESH_BED_LEVELING
791
 
765
 
792
 //===========================================================================
766
 //===========================================================================
793
-//============================ Auto Bed Leveling ============================
767
+//=============================== Bed Leveling ==============================
794
 //===========================================================================
768
 //===========================================================================
795
 // @section bedlevel
769
 // @section bedlevel
796
 
770
 
814
  *   Probe several points in a grid.
788
  *   Probe several points in a grid.
815
  *   You specify the rectangle and the density of sample points.
789
  *   You specify the rectangle and the density of sample points.
816
  *   The result is a mesh, best for large or uneven beds.
790
  *   The result is a mesh, best for large or uneven beds.
791
+ *
792
+ * - UBL Unified Bed Leveling
793
+ *   A comprehensive bed leveling system that combines features and benefits from previous
794
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
795
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
796
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
797
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
798
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
799
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
800
+ *       test on.
817
  */
801
  */
818
 //#define AUTO_BED_LEVELING_3POINT
802
 //#define AUTO_BED_LEVELING_3POINT
819
 //#define AUTO_BED_LEVELING_LINEAR
803
 //#define AUTO_BED_LEVELING_LINEAR
820
 //#define AUTO_BED_LEVELING_BILINEAR
804
 //#define AUTO_BED_LEVELING_BILINEAR
805
+//#define MESH_BED_LEVELING
806
+//#define AUTO_BED_LEVELING_UBL
821
 
807
 
822
 /**
808
 /**
823
  * Enable detailed logging of G28, G29, M48, etc.
809
  * Enable detailed logging of G28, G29, M48, etc.
826
  */
812
  */
827
 //#define DEBUG_LEVELING_FEATURE
813
 //#define DEBUG_LEVELING_FEATURE
828
 
814
 
815
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
816
+  // Gradually reduce leveling correction until a set height is reached,
817
+  // at which point movement will be level to the machine's XY plane.
818
+  // The height can be set with M420 Z<height>
819
+  #define ENABLE_LEVELING_FADE_HEIGHT
820
+#endif
821
+
829
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
822
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
830
 
823
 
831
   // Set the number of grid points per dimension.
824
   // Set the number of grid points per dimension.
846
 
839
 
847
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
840
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
848
 
841
 
849
-    // Gradually reduce leveling correction until a set height is reached,
850
-    // at which point movement will be level to the machine's XY plane.
851
-    // The height can be set with M420 Z<height>
852
-    #define ENABLE_LEVELING_FADE_HEIGHT
853
-
854
     //
842
     //
855
     // Experimental Subdivision of the grid by Catmull-Rom method.
843
     // Experimental Subdivision of the grid by Catmull-Rom method.
856
     // Synthesizes intermediate points to produce a more detailed mesh.
844
     // Synthesizes intermediate points to produce a more detailed mesh.
874
   #define ABL_PROBE_PT_3_X 170
862
   #define ABL_PROBE_PT_3_X 170
875
   #define ABL_PROBE_PT_3_Y 20
863
   #define ABL_PROBE_PT_3_Y 20
876
 
864
 
877
-#endif
865
+#elif ENABLED(MESH_BED_LEVELING)
866
+
867
+//===========================================================================
868
+//=================================== Mesh ==================================
869
+//===========================================================================
870
+
871
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
872
+  #define MESH_INSET 10          // Mesh inset margin on print area
873
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
874
+  #define MESH_NUM_Y_POINTS 3
875
+
876
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
877
+
878
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
879
+
880
+  #if ENABLED(MANUAL_BED_LEVELING)
881
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
882
+  #endif  // MANUAL_BED_LEVELING
883
+
884
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
885
+
886
+//===========================================================================
887
+//========================= Unified Bed Leveling ============================
888
+//===========================================================================
889
+
890
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
891
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
892
+  #define UBL_MESH_NUM_Y_POINTS 10
893
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
894
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
895
+  #define UBL_PROBE_PT_2_X 39
896
+  #define UBL_PROBE_PT_2_Y 20
897
+  #define UBL_PROBE_PT_3_X 180
898
+  #define UBL_PROBE_PT_3_Y 20
899
+
900
+#endif  // BED_LEVELING
878
 
901
 
879
 /**
902
 /**
880
  * Commands to execute at the end of G29 probing.
903
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/WITBOX/Configuration.h Просмотреть файл

234
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
234
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
235
  *    66 : 4.7M High Temperature thermistor from Dyze Design
235
  *    66 : 4.7M High Temperature thermistor from Dyze Design
236
  *    70 : the 100K thermistor found in the bq Hephestos 2
236
  *    70 : the 100K thermistor found in the bq Hephestos 2
237
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
237
  *
238
  *
238
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
239
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
239
  *                              (but gives greater accuracy and more stable PID)
240
  *                              (but gives greater accuracy and more stable PID)
595
 //
596
 //
596
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
597
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
597
 //
598
 //
598
-// For a servo-based Z probe, you must set up servo support below, including
599
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
599
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
600
 //
600
 //
601
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
601
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
602
 // - Use 5V for powered (usu. inductive) sensors.
602
 // - Use 5V for powered (usu. inductive) sensors.
733
   #define FILAMENT_RUNOUT_SCRIPT "M600"
733
   #define FILAMENT_RUNOUT_SCRIPT "M600"
734
 #endif
734
 #endif
735
 
735
 
736
-//===========================================================================
737
-//============================ Mesh Bed Leveling ============================
738
-//===========================================================================
739
-
740
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
741
-
742
-#if ENABLED(MESH_BED_LEVELING)
743
-  #define MESH_INSET 10        // Mesh inset margin on print area
744
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
745
-  #define MESH_NUM_Y_POINTS 3
746
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
747
-
748
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
749
-
750
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
751
-
752
-  #if ENABLED(MANUAL_BED_LEVELING)
753
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
754
-  #endif  // MANUAL_BED_LEVELING
755
-
756
-  // Gradually reduce leveling correction until a set height is reached,
757
-  // at which point movement will be level to the machine's XY plane.
758
-  // The height can be set with M420 Z<height>
759
-  #define ENABLE_LEVELING_FADE_HEIGHT
760
-
761
-#endif  // MESH_BED_LEVELING
762
 
736
 
763
 //===========================================================================
737
 //===========================================================================
764
-//============================ Auto Bed Leveling ============================
738
+//=============================== Bed Leveling ==============================
765
 //===========================================================================
739
 //===========================================================================
766
 // @section bedlevel
740
 // @section bedlevel
767
 
741
 
785
  *   Probe several points in a grid.
759
  *   Probe several points in a grid.
786
  *   You specify the rectangle and the density of sample points.
760
  *   You specify the rectangle and the density of sample points.
787
  *   The result is a mesh, best for large or uneven beds.
761
  *   The result is a mesh, best for large or uneven beds.
762
+ *
763
+ * - UBL Unified Bed Leveling
764
+ *   A comprehensive bed leveling system that combines features and benefits from previous
765
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
766
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
767
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
768
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
769
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
770
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
771
+ *       test on.
788
  */
772
  */
789
 //#define AUTO_BED_LEVELING_3POINT
773
 //#define AUTO_BED_LEVELING_3POINT
790
 //#define AUTO_BED_LEVELING_LINEAR
774
 //#define AUTO_BED_LEVELING_LINEAR
791
 //#define AUTO_BED_LEVELING_BILINEAR
775
 //#define AUTO_BED_LEVELING_BILINEAR
776
+//#define MESH_BED_LEVELING
777
+//#define AUTO_BED_LEVELING_UBL
792
 
778
 
793
 /**
779
 /**
794
  * Enable detailed logging of G28, G29, M48, etc.
780
  * Enable detailed logging of G28, G29, M48, etc.
797
  */
783
  */
798
 //#define DEBUG_LEVELING_FEATURE
784
 //#define DEBUG_LEVELING_FEATURE
799
 
785
 
786
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
787
+  // Gradually reduce leveling correction until a set height is reached,
788
+  // at which point movement will be level to the machine's XY plane.
789
+  // The height can be set with M420 Z<height>
790
+  #define ENABLE_LEVELING_FADE_HEIGHT
791
+#endif
792
+
800
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
793
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 
794
 
802
   // Set the number of grid points per dimension.
795
   // Set the number of grid points per dimension.
817
 
810
 
818
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
811
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
 
812
 
820
-    // Gradually reduce leveling correction until a set height is reached,
821
-    // at which point movement will be level to the machine's XY plane.
822
-    // The height can be set with M420 Z<height>
823
-    #define ENABLE_LEVELING_FADE_HEIGHT
824
-
825
     //
813
     //
826
     // Experimental Subdivision of the grid by Catmull-Rom method.
814
     // Experimental Subdivision of the grid by Catmull-Rom method.
827
     // Synthesizes intermediate points to produce a more detailed mesh.
815
     // Synthesizes intermediate points to produce a more detailed mesh.
845
   #define ABL_PROBE_PT_3_X 170
833
   #define ABL_PROBE_PT_3_X 170
846
   #define ABL_PROBE_PT_3_Y 20
834
   #define ABL_PROBE_PT_3_Y 20
847
 
835
 
848
-#endif
836
+#elif ENABLED(MESH_BED_LEVELING)
837
+
838
+//===========================================================================
839
+//=================================== Mesh ==================================
840
+//===========================================================================
841
+
842
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
843
+  #define MESH_INSET 10          // Mesh inset margin on print area
844
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
845
+  #define MESH_NUM_Y_POINTS 3
846
+
847
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
848
+
849
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
850
+
851
+  #if ENABLED(MANUAL_BED_LEVELING)
852
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
853
+  #endif  // MANUAL_BED_LEVELING
854
+
855
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
856
+
857
+//===========================================================================
858
+//========================= Unified Bed Leveling ============================
859
+//===========================================================================
860
+
861
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
862
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
863
+  #define UBL_MESH_NUM_Y_POINTS 10
864
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
865
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
866
+  #define UBL_PROBE_PT_2_X 39
867
+  #define UBL_PROBE_PT_2_Y 20
868
+  #define UBL_PROBE_PT_3_X 180
869
+  #define UBL_PROBE_PT_3_Y 20
870
+
871
+#endif  // BED_LEVELING
849
 
872
 
850
 /**
873
 /**
851
  * Commands to execute at the end of G29 probing.
874
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/adafruit/ST7565/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
603
 //
604
 //
604
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
605
 //
606
 //
606
-// For a servo-based Z probe, you must set up servo support below, including
607
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
607
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
608
 //
608
 //
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
609
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
610
 // - Use 5V for powered (usu. inductive) sensors.
610
 // - Use 5V for powered (usu. inductive) sensors.
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
741
   #define FILAMENT_RUNOUT_SCRIPT "M600"
742
 #endif
742
 #endif
743
 
743
 
744
-//===========================================================================
745
-//============================ Mesh Bed Leveling ============================
746
-//===========================================================================
747
-
748
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
749
-
750
-#if ENABLED(MESH_BED_LEVELING)
751
-  #define MESH_INSET 10        // Mesh inset margin on print area
752
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
753
-  #define MESH_NUM_Y_POINTS 3
754
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
755
-
756
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
757
-
758
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
759
-
760
-  #if ENABLED(MANUAL_BED_LEVELING)
761
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
762
-  #endif  // MANUAL_BED_LEVELING
763
-
764
-  // Gradually reduce leveling correction until a set height is reached,
765
-  // at which point movement will be level to the machine's XY plane.
766
-  // The height can be set with M420 Z<height>
767
-  #define ENABLE_LEVELING_FADE_HEIGHT
768
-
769
-#endif  // MESH_BED_LEVELING
770
 
744
 
771
 //===========================================================================
745
 //===========================================================================
772
-//============================ Auto Bed Leveling ============================
746
+//=============================== Bed Leveling ==============================
773
 //===========================================================================
747
 //===========================================================================
774
 // @section bedlevel
748
 // @section bedlevel
775
 
749
 
793
  *   Probe several points in a grid.
767
  *   Probe several points in a grid.
794
  *   You specify the rectangle and the density of sample points.
768
  *   You specify the rectangle and the density of sample points.
795
  *   The result is a mesh, best for large or uneven beds.
769
  *   The result is a mesh, best for large or uneven beds.
770
+ *
771
+ * - UBL Unified Bed Leveling
772
+ *   A comprehensive bed leveling system that combines features and benefits from previous
773
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
774
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
775
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
776
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
777
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
778
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
779
+ *       test on.
796
  */
780
  */
797
 //#define AUTO_BED_LEVELING_3POINT
781
 //#define AUTO_BED_LEVELING_3POINT
798
 //#define AUTO_BED_LEVELING_LINEAR
782
 //#define AUTO_BED_LEVELING_LINEAR
799
 //#define AUTO_BED_LEVELING_BILINEAR
783
 //#define AUTO_BED_LEVELING_BILINEAR
784
+//#define MESH_BED_LEVELING
785
+//#define AUTO_BED_LEVELING_UBL
800
 
786
 
801
 /**
787
 /**
802
  * Enable detailed logging of G28, G29, M48, etc.
788
  * Enable detailed logging of G28, G29, M48, etc.
805
  */
791
  */
806
 //#define DEBUG_LEVELING_FEATURE
792
 //#define DEBUG_LEVELING_FEATURE
807
 
793
 
794
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
795
+  // Gradually reduce leveling correction until a set height is reached,
796
+  // at which point movement will be level to the machine's XY plane.
797
+  // The height can be set with M420 Z<height>
798
+  #define ENABLE_LEVELING_FADE_HEIGHT
799
+#endif
800
+
808
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
801
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
809
 
802
 
810
   // Set the number of grid points per dimension.
803
   // Set the number of grid points per dimension.
825
 
818
 
826
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
819
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
827
 
820
 
828
-    // Gradually reduce leveling correction until a set height is reached,
829
-    // at which point movement will be level to the machine's XY plane.
830
-    // The height can be set with M420 Z<height>
831
-    #define ENABLE_LEVELING_FADE_HEIGHT
832
-
833
     //
821
     //
834
     // Experimental Subdivision of the grid by Catmull-Rom method.
822
     // Experimental Subdivision of the grid by Catmull-Rom method.
835
     // Synthesizes intermediate points to produce a more detailed mesh.
823
     // Synthesizes intermediate points to produce a more detailed mesh.
853
   #define ABL_PROBE_PT_3_X 170
841
   #define ABL_PROBE_PT_3_X 170
854
   #define ABL_PROBE_PT_3_Y 20
842
   #define ABL_PROBE_PT_3_Y 20
855
 
843
 
856
-#endif
844
+#elif ENABLED(MESH_BED_LEVELING)
845
+
846
+//===========================================================================
847
+//=================================== Mesh ==================================
848
+//===========================================================================
849
+
850
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
851
+  #define MESH_INSET 10          // Mesh inset margin on print area
852
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
853
+  #define MESH_NUM_Y_POINTS 3
854
+
855
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
856
+
857
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
858
+
859
+  #if ENABLED(MANUAL_BED_LEVELING)
860
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
861
+  #endif  // MANUAL_BED_LEVELING
862
+
863
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
864
+
865
+//===========================================================================
866
+//========================= Unified Bed Leveling ============================
867
+//===========================================================================
868
+
869
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
870
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
871
+  #define UBL_MESH_NUM_Y_POINTS 10
872
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
873
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
874
+  #define UBL_PROBE_PT_2_X 39
875
+  #define UBL_PROBE_PT_2_Y 20
876
+  #define UBL_PROBE_PT_3_X 180
877
+  #define UBL_PROBE_PT_3_Y 20
878
+
879
+#endif  // BED_LEVELING
857
 
880
 
858
 /**
881
 /**
859
  * Commands to execute at the end of G29 probing.
882
  * Commands to execute at the end of G29 probing.

+ 58
- 38
Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
705
 //
706
 //
706
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
707
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
707
 //
708
 //
708
-// For a servo-based Z probe, you must set up servo support below, including
709
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
709
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
710
 //
710
 //
711
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
711
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
712
 // - Use 5V for powered (usu. inductive) sensors.
712
 // - Use 5V for powered (usu. inductive) sensors.
844
 #endif
844
 #endif
845
 
845
 
846
 //===========================================================================
846
 //===========================================================================
847
-//============================ Mesh Bed Leveling ============================
848
-//===========================================================================
849
-//
850
-// MESH_BED_LEVELING does not yet support DELTA printers.
851
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
852
-
853
-#if ENABLED(MESH_BED_LEVELING)
854
-  #define MESH_INSET 10        // Mesh inset margin on print area
855
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
856
-  #define MESH_NUM_Y_POINTS 3
857
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
858
-
859
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
860
-
861
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
862
-
863
-  #if ENABLED(MANUAL_BED_LEVELING)
864
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
865
-  #endif  // MANUAL_BED_LEVELING
866
-
867
-  // Gradually reduce leveling correction until a set height is reached,
868
-  // at which point movement will be level to the machine's XY plane.
869
-  // The height can be set with M420 Z<height>
870
-  #define ENABLE_LEVELING_FADE_HEIGHT
871
-
872
-#endif  // MESH_BED_LEVELING
873
-
874
-//===========================================================================
875
-//============================ Auto Bed Leveling ============================
847
+//=============================== Bed Leveling ==============================
876
 //===========================================================================
848
 //===========================================================================
877
 // @section bedlevel
849
 // @section bedlevel
878
 
850
 
896
  *   Probe several points in a grid.
868
  *   Probe several points in a grid.
897
  *   You specify the rectangle and the density of sample points.
869
  *   You specify the rectangle and the density of sample points.
898
  *   The result is a mesh, best for large or uneven beds.
870
  *   The result is a mesh, best for large or uneven beds.
871
+ *
872
+ * - UBL Unified Bed Leveling
873
+ *   A comprehensive bed leveling system that combines features and benefits from previous
874
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
875
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
876
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
877
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
878
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
879
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
880
+ *       test on.
899
  */
881
  */
900
 //#define AUTO_BED_LEVELING_3POINT // Only AUTO_BED_LEVELING_BILINEAR is supported for DELTA bed leveling.
882
 //#define AUTO_BED_LEVELING_3POINT // Only AUTO_BED_LEVELING_BILINEAR is supported for DELTA bed leveling.
901
 //#define AUTO_BED_LEVELING_LINEAR // Only AUTO_BED_LEVELING_BILINEAR is supported for DELTA bed leveling.
883
 //#define AUTO_BED_LEVELING_LINEAR // Only AUTO_BED_LEVELING_BILINEAR is supported for DELTA bed leveling.
902
 #define AUTO_BED_LEVELING_BILINEAR // Only AUTO_BED_LEVELING_BILINEAR is supported for DELTA bed leveling.
884
 #define AUTO_BED_LEVELING_BILINEAR // Only AUTO_BED_LEVELING_BILINEAR is supported for DELTA bed leveling.
885
+//#define MESH_BED_LEVELING
886
+//#define AUTO_BED_LEVELING_UBL
903
 
887
 
904
 /**
888
 /**
905
  * Enable detailed logging of G28, G29, M48, etc.
889
  * Enable detailed logging of G28, G29, M48, etc.
908
  */
892
  */
909
 //#define DEBUG_LEVELING_FEATURE
893
 //#define DEBUG_LEVELING_FEATURE
910
 
894
 
895
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
896
+  // Gradually reduce leveling correction until a set height is reached,
897
+  // at which point movement will be level to the machine's XY plane.
898
+  // The height can be set with M420 Z<height>
899
+  //#define ENABLE_LEVELING_FADE_HEIGHT
900
+#endif
901
+
911
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
902
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
912
 
903
 
913
   // Set the number of grid points per dimension.
904
   // Set the number of grid points per dimension.
928
   //#define PROBE_Y_FIRST
919
   //#define PROBE_Y_FIRST
929
 
920
 
930
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
921
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
931
-
932
-    // Gradually reduce leveling correction until a set height is reached,
933
-    // at which point movement will be level to the machine's XY plane.
934
-    // The height can be set with M420 Z<height>
935
-    //#define ENABLE_LEVELING_FADE_HEIGHT
936
-
937
     //
922
     //
938
     // Experimental Subdivision of the grid by Catmull-Rom method.
923
     // Experimental Subdivision of the grid by Catmull-Rom method.
939
     // Synthesizes intermediate points to produce a more detailed mesh.
924
     // Synthesizes intermediate points to produce a more detailed mesh.
957
   #define ABL_PROBE_PT_3_X 170
942
   #define ABL_PROBE_PT_3_X 170
958
   #define ABL_PROBE_PT_3_Y 20
943
   #define ABL_PROBE_PT_3_Y 20
959
 
944
 
960
-#endif
945
+#elif ENABLED(MESH_BED_LEVELING)
946
+
947
+//===========================================================================
948
+//=================================== Mesh ==================================
949
+//===========================================================================
950
+
951
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
952
+  #define MESH_INSET 10          // Mesh inset margin on print area
953
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
954
+  #define MESH_NUM_Y_POINTS 3
955
+
956
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
957
+
958
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
959
+
960
+  #if ENABLED(MANUAL_BED_LEVELING)
961
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
962
+  #endif  // MANUAL_BED_LEVELING
963
+
964
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
965
+
966
+//===========================================================================
967
+//========================= Unified Bed Leveling ============================
968
+//===========================================================================
969
+
970
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
971
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
972
+  #define UBL_MESH_NUM_Y_POINTS 10
973
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
974
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
975
+  #define UBL_PROBE_PT_2_X 39
976
+  #define UBL_PROBE_PT_2_Y 20
977
+  #define UBL_PROBE_PT_3_X 180
978
+  #define UBL_PROBE_PT_3_Y 20
979
+
980
+#endif  // BED_LEVELING
961
 
981
 
962
 /**
982
 /**
963
  * Commands to execute at the end of G29 probing.
983
  * Commands to execute at the end of G29 probing.

+ 58
- 36
Marlin/example_configurations/delta/generic/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
689
 //
690
 //
690
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
691
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
691
 //
692
 //
692
-// For a servo-based Z probe, you must set up servo support below, including
693
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
693
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
694
 //
694
 //
695
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
695
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
696
 // - Use 5V for powered (usu. inductive) sensors.
696
 // - Use 5V for powered (usu. inductive) sensors.
827
   #define FILAMENT_RUNOUT_SCRIPT "M600"
827
   #define FILAMENT_RUNOUT_SCRIPT "M600"
828
 #endif
828
 #endif
829
 
829
 
830
-//===========================================================================
831
-//============================ Mesh Bed Leveling ============================
832
-//===========================================================================
833
-
834
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
835
-
836
-#if ENABLED(MESH_BED_LEVELING)
837
-  #define MESH_INSET 10        // Mesh inset margin on print area
838
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
839
-  #define MESH_NUM_Y_POINTS 3
840
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
841
-
842
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
843
-
844
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
845
-
846
-  #if ENABLED(MANUAL_BED_LEVELING)
847
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
848
-  #endif  // MANUAL_BED_LEVELING
849
-
850
-  // Gradually reduce leveling correction until a set height is reached,
851
-  // at which point movement will be level to the machine's XY plane.
852
-  // The height can be set with M420 Z<height>
853
-  #define ENABLE_LEVELING_FADE_HEIGHT
854
-
855
-#endif  // MESH_BED_LEVELING
856
 
830
 
857
 //===========================================================================
831
 //===========================================================================
858
-//============================ Auto Bed Leveling ============================
832
+//=============================== Bed Leveling ==============================
859
 //===========================================================================
833
 //===========================================================================
860
 // @section bedlevel
834
 // @section bedlevel
861
 
835
 
879
  *   Probe several points in a grid.
853
  *   Probe several points in a grid.
880
  *   You specify the rectangle and the density of sample points.
854
  *   You specify the rectangle and the density of sample points.
881
  *   The result is a mesh, best for large or uneven beds.
855
  *   The result is a mesh, best for large or uneven beds.
856
+ *
857
+ * - UBL Unified Bed Leveling
858
+ *   A comprehensive bed leveling system that combines features and benefits from previous
859
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
860
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
861
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
862
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
863
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
864
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
865
+ *       test on.
882
  */
866
  */
883
 //#define AUTO_BED_LEVELING_3POINT
867
 //#define AUTO_BED_LEVELING_3POINT
884
 //#define AUTO_BED_LEVELING_LINEAR
868
 //#define AUTO_BED_LEVELING_LINEAR
885
 //#define AUTO_BED_LEVELING_BILINEAR
869
 //#define AUTO_BED_LEVELING_BILINEAR
870
+//#define MESH_BED_LEVELING
871
+//#define AUTO_BED_LEVELING_UBL
886
 
872
 
887
 /**
873
 /**
888
  * Enable detailed logging of G28, G29, M48, etc.
874
  * Enable detailed logging of G28, G29, M48, etc.
891
  */
877
  */
892
 //#define DEBUG_LEVELING_FEATURE
878
 //#define DEBUG_LEVELING_FEATURE
893
 
879
 
880
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
881
+  // Gradually reduce leveling correction until a set height is reached,
882
+  // at which point movement will be level to the machine's XY plane.
883
+  // The height can be set with M420 Z<height>
884
+  //#define ENABLE_LEVELING_FADE_HEIGHT
885
+#endif
886
+
894
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
887
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
895
 
888
 
896
   // Set the number of grid points per dimension.
889
   // Set the number of grid points per dimension.
912
   //#define PROBE_Y_FIRST
905
   //#define PROBE_Y_FIRST
913
 
906
 
914
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
907
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
915
-
916
-    // Gradually reduce leveling correction until a set height is reached,
917
-    // at which point movement will be level to the machine's XY plane.
918
-    // The height can be set with M420 Z<height>
919
-    //#define ENABLE_LEVELING_FADE_HEIGHT
920
-
921
     //
908
     //
922
     // Experimental Subdivision of the grid by Catmull-Rom method.
909
     // Experimental Subdivision of the grid by Catmull-Rom method.
923
     // Synthesizes intermediate points to produce a more detailed mesh.
910
     // Synthesizes intermediate points to produce a more detailed mesh.
941
   #define ABL_PROBE_PT_3_X 170
928
   #define ABL_PROBE_PT_3_X 170
942
   #define ABL_PROBE_PT_3_Y 20
929
   #define ABL_PROBE_PT_3_Y 20
943
 
930
 
944
-#endif
931
+#elif ENABLED(MESH_BED_LEVELING)
932
+
933
+//===========================================================================
934
+//=================================== Mesh ==================================
935
+//===========================================================================
936
+
937
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
938
+  #define MESH_INSET 10          // Mesh inset margin on print area
939
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
940
+  #define MESH_NUM_Y_POINTS 3
941
+
942
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
943
+
944
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
945
+
946
+  #if ENABLED(MANUAL_BED_LEVELING)
947
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
948
+  #endif  // MANUAL_BED_LEVELING
949
+
950
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
951
+
952
+//===========================================================================
953
+//========================= Unified Bed Leveling ============================
954
+//===========================================================================
955
+
956
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
957
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
958
+  #define UBL_MESH_NUM_Y_POINTS 10
959
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
960
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
961
+  #define UBL_PROBE_PT_2_X 39
962
+  #define UBL_PROBE_PT_2_Y 20
963
+  #define UBL_PROBE_PT_3_X 180
964
+  #define UBL_PROBE_PT_3_Y 20
965
+
966
+#endif  // BED_LEVELING
945
 
967
 
946
 /**
968
 /**
947
  * Commands to execute at the end of G29 probing.
969
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/delta/kossel_mini/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
692
 //
693
 //
693
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
694
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
694
 //
695
 //
695
-// For a servo-based Z probe, you must set up servo support below, including
696
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
696
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
697
 //
697
 //
698
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
698
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
699
 // - Use 5V for powered (usu. inductive) sensors.
699
 // - Use 5V for powered (usu. inductive) sensors.
830
   #define FILAMENT_RUNOUT_SCRIPT "M600"
830
   #define FILAMENT_RUNOUT_SCRIPT "M600"
831
 #endif
831
 #endif
832
 
832
 
833
-//===========================================================================
834
-//============================ Mesh Bed Leveling ============================
835
-//===========================================================================
836
-
837
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
838
-
839
-#if ENABLED(MESH_BED_LEVELING)
840
-  #define MESH_INSET 10        // Mesh inset margin on print area
841
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
842
-  #define MESH_NUM_Y_POINTS 3
843
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
844
-
845
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
846
-
847
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
848
-
849
-  #if ENABLED(MANUAL_BED_LEVELING)
850
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
851
-  #endif  // MANUAL_BED_LEVELING
852
-
853
-  // Gradually reduce leveling correction until a set height is reached,
854
-  // at which point movement will be level to the machine's XY plane.
855
-  // The height can be set with M420 Z<height>
856
-  #define ENABLE_LEVELING_FADE_HEIGHT
857
-
858
-#endif  // MESH_BED_LEVELING
859
 
833
 
860
 //===========================================================================
834
 //===========================================================================
861
-//============================ Auto Bed Leveling ============================
835
+//=============================== Bed Leveling ==============================
862
 //===========================================================================
836
 //===========================================================================
863
 // @section bedlevel
837
 // @section bedlevel
864
 
838
 
882
  *   Probe several points in a grid.
856
  *   Probe several points in a grid.
883
  *   You specify the rectangle and the density of sample points.
857
  *   You specify the rectangle and the density of sample points.
884
  *   The result is a mesh, best for large or uneven beds.
858
  *   The result is a mesh, best for large or uneven beds.
859
+ *
860
+ * - UBL Unified Bed Leveling
861
+ *   A comprehensive bed leveling system that combines features and benefits from previous
862
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
863
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
864
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
865
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
866
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
867
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
868
+ *       test on.
885
  */
869
  */
886
 //#define AUTO_BED_LEVELING_3POINT
870
 //#define AUTO_BED_LEVELING_3POINT
887
 //#define AUTO_BED_LEVELING_LINEAR
871
 //#define AUTO_BED_LEVELING_LINEAR
888
 //#define AUTO_BED_LEVELING_BILINEAR
872
 //#define AUTO_BED_LEVELING_BILINEAR
873
+//#define MESH_BED_LEVELING
874
+//#define AUTO_BED_LEVELING_UBL
889
 
875
 
890
 /**
876
 /**
891
  * Enable detailed logging of G28, G29, M48, etc.
877
  * Enable detailed logging of G28, G29, M48, etc.
894
  */
880
  */
895
 //#define DEBUG_LEVELING_FEATURE
881
 //#define DEBUG_LEVELING_FEATURE
896
 
882
 
883
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
884
+  // Gradually reduce leveling correction until a set height is reached,
885
+  // at which point movement will be level to the machine's XY plane.
886
+  // The height can be set with M420 Z<height>
887
+  //#define ENABLE_LEVELING_FADE_HEIGHT
888
+#endif
889
+
897
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
890
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
898
 
891
 
899
   // Set the number of grid points per dimension.
892
   // Set the number of grid points per dimension.
916
 
909
 
917
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
910
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
918
 
911
 
919
-    // Gradually reduce leveling correction until a set height is reached,
920
-    // at which point movement will be level to the machine's XY plane.
921
-    // The height can be set with M420 Z<height>
922
-    #define ENABLE_LEVELING_FADE_HEIGHT
923
-
924
     //
912
     //
925
     // Experimental Subdivision of the grid by Catmull-Rom method.
913
     // Experimental Subdivision of the grid by Catmull-Rom method.
926
     // Synthesizes intermediate points to produce a more detailed mesh.
914
     // Synthesizes intermediate points to produce a more detailed mesh.
944
   #define ABL_PROBE_PT_3_X 170
932
   #define ABL_PROBE_PT_3_X 170
945
   #define ABL_PROBE_PT_3_Y 20
933
   #define ABL_PROBE_PT_3_Y 20
946
 
934
 
947
-#endif
935
+#elif ENABLED(MESH_BED_LEVELING)
936
+
937
+//===========================================================================
938
+//=================================== Mesh ==================================
939
+//===========================================================================
940
+
941
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
942
+  #define MESH_INSET 10          // Mesh inset margin on print area
943
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
944
+  #define MESH_NUM_Y_POINTS 3
945
+
946
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
947
+
948
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
949
+
950
+  #if ENABLED(MANUAL_BED_LEVELING)
951
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
952
+  #endif  // MANUAL_BED_LEVELING
953
+
954
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
955
+
956
+//===========================================================================
957
+//========================= Unified Bed Leveling ============================
958
+//===========================================================================
959
+
960
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
961
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
962
+  #define UBL_MESH_NUM_Y_POINTS 10
963
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
964
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
965
+  #define UBL_PROBE_PT_2_X 39
966
+  #define UBL_PROBE_PT_2_Y 20
967
+  #define UBL_PROBE_PT_3_X 180
968
+  #define UBL_PROBE_PT_3_Y 20
969
+
970
+#endif  // BED_LEVELING
948
 
971
 
949
 /**
972
 /**
950
  * Commands to execute at the end of G29 probing.
973
  * Commands to execute at the end of G29 probing.

+ 59
- 36
Marlin/example_configurations/delta/kossel_pro/Configuration.h Просмотреть файл

235
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
235
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
236
  *    66 : 4.7M High Temperature thermistor from Dyze Design
236
  *    66 : 4.7M High Temperature thermistor from Dyze Design
237
  *    70 : the 100K thermistor found in the bq Hephestos 2
237
  *    70 : the 100K thermistor found in the bq Hephestos 2
238
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
238
  *
239
  *
239
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
240
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
240
  *                              (but gives greater accuracy and more stable PID)
241
  *                              (but gives greater accuracy and more stable PID)
691
 //
692
 //
692
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
693
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
693
 //
694
 //
694
-// For a servo-based Z probe, you must set up servo support below, including
695
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
695
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
696
 //
696
 //
697
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
697
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
698
 // - Use 5V for powered (usu. inductive) sensors.
698
 // - Use 5V for powered (usu. inductive) sensors.
829
   #define FILAMENT_RUNOUT_SCRIPT "M600"
829
   #define FILAMENT_RUNOUT_SCRIPT "M600"
830
 #endif
830
 #endif
831
 
831
 
832
-//===========================================================================
833
-//============================ Mesh Bed Leveling ============================
834
-//===========================================================================
835
-
836
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
837
-
838
-#if ENABLED(MESH_BED_LEVELING)
839
-  #define MESH_INSET 10        // Mesh inset margin on print area
840
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
841
-  #define MESH_NUM_Y_POINTS 3
842
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
843
-
844
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
845
-
846
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
847
-
848
-  #if ENABLED(MANUAL_BED_LEVELING)
849
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
850
-  #endif  // MANUAL_BED_LEVELING
851
-
852
-  // Gradually reduce leveling correction until a set height is reached,
853
-  // at which point movement will be level to the machine's XY plane.
854
-  // The height can be set with M420 Z<height>
855
-  #define ENABLE_LEVELING_FADE_HEIGHT
856
-
857
-#endif  // MESH_BED_LEVELING
858
 
832
 
859
 //===========================================================================
833
 //===========================================================================
860
-//============================ Auto Bed Leveling ============================
834
+//=============================== Bed Leveling ==============================
861
 //===========================================================================
835
 //===========================================================================
862
 // @section bedlevel
836
 // @section bedlevel
863
 
837
 
881
  *   Probe several points in a grid.
855
  *   Probe several points in a grid.
882
  *   You specify the rectangle and the density of sample points.
856
  *   You specify the rectangle and the density of sample points.
883
  *   The result is a mesh, best for large or uneven beds.
857
  *   The result is a mesh, best for large or uneven beds.
858
+ *
859
+ * - UBL Unified Bed Leveling
860
+ *   A comprehensive bed leveling system that combines features and benefits from previous
861
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
862
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
863
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
864
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
865
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
866
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
867
+ *       test on.
884
  */
868
  */
885
 //#define AUTO_BED_LEVELING_3POINT
869
 //#define AUTO_BED_LEVELING_3POINT
886
 //#define AUTO_BED_LEVELING_LINEAR
870
 //#define AUTO_BED_LEVELING_LINEAR
887
-#define AUTO_BED_LEVELING_BILINEAR
871
+//#define AUTO_BED_LEVELING_BILINEAR
872
+//#define MESH_BED_LEVELING
873
+//#define AUTO_BED_LEVELING_UBL
888
 
874
 
889
 /**
875
 /**
890
  * Enable detailed logging of G28, G29, M48, etc.
876
  * Enable detailed logging of G28, G29, M48, etc.
893
  */
879
  */
894
 //#define DEBUG_LEVELING_FEATURE
880
 //#define DEBUG_LEVELING_FEATURE
895
 
881
 
882
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
883
+  // Gradually reduce leveling correction until a set height is reached,
884
+  // at which point movement will be level to the machine's XY plane.
885
+  // The height can be set with M420 Z<height>
886
+  //#define ENABLE_LEVELING_FADE_HEIGHT
887
+#endif
888
+
896
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
889
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
897
 
890
 
898
   // Set the number of grid points per dimension.
891
   // Set the number of grid points per dimension.
915
 
908
 
916
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
909
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
917
 
910
 
918
-    // Gradually reduce leveling correction until a set height is reached,
919
-    // at which point movement will be level to the machine's XY plane.
920
-    // The height can be set with M420 Z<height>
921
-    //#define ENABLE_LEVELING_FADE_HEIGHT
922
-
923
     //
911
     //
924
     // Experimental Subdivision of the grid by Catmull-Rom method.
912
     // Experimental Subdivision of the grid by Catmull-Rom method.
925
     // Synthesizes intermediate points to produce a more detailed mesh.
913
     // Synthesizes intermediate points to produce a more detailed mesh.
943
   #define ABL_PROBE_PT_3_X 170
931
   #define ABL_PROBE_PT_3_X 170
944
   #define ABL_PROBE_PT_3_Y 20
932
   #define ABL_PROBE_PT_3_Y 20
945
 
933
 
946
-#endif
934
+#elif ENABLED(MESH_BED_LEVELING)
935
+
936
+//===========================================================================
937
+//=================================== Mesh ==================================
938
+//===========================================================================
939
+
940
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
941
+  #define MESH_INSET 10          // Mesh inset margin on print area
942
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
943
+  #define MESH_NUM_Y_POINTS 3
944
+
945
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
946
+
947
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
948
+
949
+  #if ENABLED(MANUAL_BED_LEVELING)
950
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
951
+  #endif  // MANUAL_BED_LEVELING
952
+
953
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
954
+
955
+//===========================================================================
956
+//========================= Unified Bed Leveling ============================
957
+//===========================================================================
958
+
959
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
960
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
961
+  #define UBL_MESH_NUM_Y_POINTS 10
962
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
963
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
964
+  #define UBL_PROBE_PT_2_X 39
965
+  #define UBL_PROBE_PT_2_Y 20
966
+  #define UBL_PROBE_PT_3_X 180
967
+  #define UBL_PROBE_PT_3_Y 20
968
+
969
+#endif  // BED_LEVELING
947
 
970
 
948
 /**
971
 /**
949
  * Commands to execute at the end of G29 probing.
972
  * Commands to execute at the end of G29 probing.

+ 66
- 37
Marlin/example_configurations/delta/kossel_xl/Configuration.h Просмотреть файл

74
 // example_configurations/delta directory.
74
 // example_configurations/delta directory.
75
 //
75
 //
76
 
76
 
77
+//===========================================================================
78
+//============================= SCARA Printer ===============================
79
+//===========================================================================
80
+// For a Scara printer replace the configuration files with the files in the
81
+// example_configurations/SCARA directory.
82
+//
83
+
77
 // @section info
84
 // @section info
78
 
85
 
79
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
86
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
224
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
225
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
226
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
227
  *
235
  *
228
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
229
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
695
 //
703
 //
696
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
704
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
697
 //
705
 //
698
-// For a servo-based Z probe, you must set up servo support below, including
699
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
706
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
700
 //
707
 //
701
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
708
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
702
 // - Use 5V for powered (usu. inductive) sensors.
709
 // - Use 5V for powered (usu. inductive) sensors.
833
   #define FILAMENT_RUNOUT_SCRIPT "M600"
840
   #define FILAMENT_RUNOUT_SCRIPT "M600"
834
 #endif
841
 #endif
835
 
842
 
836
-//===========================================================================
837
-//============================ Mesh Bed Leveling ============================
838
-//===========================================================================
839
-
840
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
841
-
842
-#if ENABLED(MESH_BED_LEVELING)
843
-  #define MESH_INSET 10        // Mesh inset margin on print area
844
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
845
-  #define MESH_NUM_Y_POINTS 3
846
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
847
-
848
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
849
-
850
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
851
-
852
-  #if ENABLED(MANUAL_BED_LEVELING)
853
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
854
-  #endif  // MANUAL_BED_LEVELING
855
-
856
-  // Gradually reduce leveling correction until a set height is reached,
857
-  // at which point movement will be level to the machine's XY plane.
858
-  // The height can be set with M420 Z<height>
859
-  #define ENABLE_LEVELING_FADE_HEIGHT
860
-
861
-#endif  // MESH_BED_LEVELING
862
 
843
 
863
 //===========================================================================
844
 //===========================================================================
864
-//============================ Auto Bed Leveling ============================
845
+//=============================== Bed Leveling ==============================
865
 //===========================================================================
846
 //===========================================================================
866
 // @section bedlevel
847
 // @section bedlevel
867
 
848
 
885
  *   Probe several points in a grid.
866
  *   Probe several points in a grid.
886
  *   You specify the rectangle and the density of sample points.
867
  *   You specify the rectangle and the density of sample points.
887
  *   The result is a mesh, best for large or uneven beds.
868
  *   The result is a mesh, best for large or uneven beds.
869
+ *
870
+ * - UBL Unified Bed Leveling
871
+ *   A comprehensive bed leveling system that combines features and benefits from previous
872
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
873
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
874
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
875
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
876
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
877
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
878
+ *       test on.
888
  */
879
  */
889
 //#define AUTO_BED_LEVELING_3POINT
880
 //#define AUTO_BED_LEVELING_3POINT
890
 //#define AUTO_BED_LEVELING_LINEAR
881
 //#define AUTO_BED_LEVELING_LINEAR
891
-#define AUTO_BED_LEVELING_BILINEAR
882
+//#define AUTO_BED_LEVELING_BILINEAR
883
+//#define MESH_BED_LEVELING
884
+//#define AUTO_BED_LEVELING_UBL
892
 
885
 
893
 /**
886
 /**
894
  * Enable detailed logging of G28, G29, M48, etc.
887
  * Enable detailed logging of G28, G29, M48, etc.
897
  */
890
  */
898
 //#define DEBUG_LEVELING_FEATURE
891
 //#define DEBUG_LEVELING_FEATURE
899
 
892
 
893
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
894
+  // Gradually reduce leveling correction until a set height is reached,
895
+  // at which point movement will be level to the machine's XY plane.
896
+  // The height can be set with M420 Z<height>
897
+  //#define ENABLE_LEVELING_FADE_HEIGHT
898
+#endif
899
+
900
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
900
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
901
 
901
 
902
   // Set the number of grid points per dimension.
902
   // Set the number of grid points per dimension.
918
   //#define PROBE_Y_FIRST
918
   //#define PROBE_Y_FIRST
919
 
919
 
920
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
920
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
921
-
922
-    // Gradually reduce leveling correction until a set height is reached,
923
-    // at which point movement will be level to the machine's XY plane.
924
-    // The height can be set with M420 Z<height>
925
-    //#define ENABLE_LEVELING_FADE_HEIGHT
926
-
927
     //
921
     //
928
     // Experimental Subdivision of the grid by Catmull-Rom method.
922
     // Experimental Subdivision of the grid by Catmull-Rom method.
929
     // Synthesizes intermediate points to produce a more detailed mesh.
923
     // Synthesizes intermediate points to produce a more detailed mesh.
947
   #define ABL_PROBE_PT_3_X 170
941
   #define ABL_PROBE_PT_3_X 170
948
   #define ABL_PROBE_PT_3_Y 20
942
   #define ABL_PROBE_PT_3_Y 20
949
 
943
 
950
-#endif
944
+#elif ENABLED(MESH_BED_LEVELING)
945
+
946
+//===========================================================================
947
+//=================================== Mesh ==================================
948
+//===========================================================================
949
+
950
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
951
+  #define MESH_INSET 10          // Mesh inset margin on print area
952
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
953
+  #define MESH_NUM_Y_POINTS 3
954
+
955
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
956
+
957
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
958
+
959
+  #if ENABLED(MANUAL_BED_LEVELING)
960
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
961
+  #endif  // MANUAL_BED_LEVELING
962
+
963
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
964
+
965
+//===========================================================================
966
+//========================= Unified Bed Leveling ============================
967
+//===========================================================================
968
+
969
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
970
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
971
+  #define UBL_MESH_NUM_Y_POINTS 10
972
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
973
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
974
+  #define UBL_PROBE_PT_2_X 39
975
+  #define UBL_PROBE_PT_2_Y 20
976
+  #define UBL_PROBE_PT_3_X 180
977
+  #define UBL_PROBE_PT_3_Y 20
978
+
979
+#endif  // BED_LEVELING
951
 
980
 
952
 /**
981
 /**
953
  * Commands to execute at the end of G29 probing.
982
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/makibox/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
606
 //
607
 //
607
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
608
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
608
 //
609
 //
609
-// For a servo-based Z probe, you must set up servo support below, including
610
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
610
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
611
 //
611
 //
612
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
612
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
613
 // - Use 5V for powered (usu. inductive) sensors.
613
 // - Use 5V for powered (usu. inductive) sensors.
744
   #define FILAMENT_RUNOUT_SCRIPT "M600"
744
   #define FILAMENT_RUNOUT_SCRIPT "M600"
745
 #endif
745
 #endif
746
 
746
 
747
-//===========================================================================
748
-//============================ Mesh Bed Leveling ============================
749
-//===========================================================================
750
-
751
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
752
-
753
-#if ENABLED(MESH_BED_LEVELING)
754
-  #define MESH_INSET 10        // Mesh inset margin on print area
755
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
756
-  #define MESH_NUM_Y_POINTS 3
757
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
758
-
759
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
760
-
761
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
762
-
763
-  #if ENABLED(MANUAL_BED_LEVELING)
764
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
765
-  #endif  // MANUAL_BED_LEVELING
766
-
767
-  // Gradually reduce leveling correction until a set height is reached,
768
-  // at which point movement will be level to the machine's XY plane.
769
-  // The height can be set with M420 Z<height>
770
-  #define ENABLE_LEVELING_FADE_HEIGHT
771
-
772
-#endif  // MESH_BED_LEVELING
773
 
747
 
774
 //===========================================================================
748
 //===========================================================================
775
-//============================ Auto Bed Leveling ============================
749
+//=============================== Bed Leveling ==============================
776
 //===========================================================================
750
 //===========================================================================
777
 // @section bedlevel
751
 // @section bedlevel
778
 
752
 
796
  *   Probe several points in a grid.
770
  *   Probe several points in a grid.
797
  *   You specify the rectangle and the density of sample points.
771
  *   You specify the rectangle and the density of sample points.
798
  *   The result is a mesh, best for large or uneven beds.
772
  *   The result is a mesh, best for large or uneven beds.
773
+ *
774
+ * - UBL Unified Bed Leveling
775
+ *   A comprehensive bed leveling system that combines features and benefits from previous
776
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
777
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
778
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
779
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
780
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
781
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
782
+ *       test on.
799
  */
783
  */
800
 //#define AUTO_BED_LEVELING_3POINT
784
 //#define AUTO_BED_LEVELING_3POINT
801
 //#define AUTO_BED_LEVELING_LINEAR
785
 //#define AUTO_BED_LEVELING_LINEAR
802
 //#define AUTO_BED_LEVELING_BILINEAR
786
 //#define AUTO_BED_LEVELING_BILINEAR
787
+//#define MESH_BED_LEVELING
788
+//#define AUTO_BED_LEVELING_UBL
803
 
789
 
804
 /**
790
 /**
805
  * Enable detailed logging of G28, G29, M48, etc.
791
  * Enable detailed logging of G28, G29, M48, etc.
808
  */
794
  */
809
 //#define DEBUG_LEVELING_FEATURE
795
 //#define DEBUG_LEVELING_FEATURE
810
 
796
 
797
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
798
+  // Gradually reduce leveling correction until a set height is reached,
799
+  // at which point movement will be level to the machine's XY plane.
800
+  // The height can be set with M420 Z<height>
801
+  #define ENABLE_LEVELING_FADE_HEIGHT
802
+#endif
803
+
811
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
804
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
812
 
805
 
813
   // Set the number of grid points per dimension.
806
   // Set the number of grid points per dimension.
828
 
821
 
829
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
822
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
830
 
823
 
831
-    // Gradually reduce leveling correction until a set height is reached,
832
-    // at which point movement will be level to the machine's XY plane.
833
-    // The height can be set with M420 Z<height>
834
-    #define ENABLE_LEVELING_FADE_HEIGHT
835
-
836
     //
824
     //
837
     // Experimental Subdivision of the grid by Catmull-Rom method.
825
     // Experimental Subdivision of the grid by Catmull-Rom method.
838
     // Synthesizes intermediate points to produce a more detailed mesh.
826
     // Synthesizes intermediate points to produce a more detailed mesh.
856
   #define ABL_PROBE_PT_3_X 170
844
   #define ABL_PROBE_PT_3_X 170
857
   #define ABL_PROBE_PT_3_Y 20
845
   #define ABL_PROBE_PT_3_Y 20
858
 
846
 
859
-#endif
847
+#elif ENABLED(MESH_BED_LEVELING)
848
+
849
+//===========================================================================
850
+//=================================== Mesh ==================================
851
+//===========================================================================
852
+
853
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
854
+  #define MESH_INSET 10          // Mesh inset margin on print area
855
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
856
+  #define MESH_NUM_Y_POINTS 3
857
+
858
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
859
+
860
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
861
+
862
+  #if ENABLED(MANUAL_BED_LEVELING)
863
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
864
+  #endif  // MANUAL_BED_LEVELING
865
+
866
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
867
+
868
+//===========================================================================
869
+//========================= Unified Bed Leveling ============================
870
+//===========================================================================
871
+
872
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
873
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
874
+  #define UBL_MESH_NUM_Y_POINTS 10
875
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
876
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
877
+  #define UBL_PROBE_PT_2_X 39
878
+  #define UBL_PROBE_PT_2_Y 20
879
+  #define UBL_PROBE_PT_3_X 180
880
+  #define UBL_PROBE_PT_3_Y 20
881
+
882
+#endif  // BED_LEVELING
860
 
883
 
861
 /**
884
 /**
862
  * Commands to execute at the end of G29 probing.
885
  * Commands to execute at the end of G29 probing.

+ 58
- 35
Marlin/example_configurations/tvrrug/Round2/Configuration.h Просмотреть файл

231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
231
  *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
232
  *    66 : 4.7M High Temperature thermistor from Dyze Design
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
233
  *    70 : the 100K thermistor found in the bq Hephestos 2
234
+ *    75 : 100k Generic Silicon Heat Pad typically a NTC 100K MGB18-104F39050L32 thermistor
234
  *
235
  *
235
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
236
  *                              (but gives greater accuracy and more stable PID)
237
  *                              (but gives greater accuracy and more stable PID)
599
 //
600
 //
600
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
601
 // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN.
601
 //
602
 //
602
-// For a servo-based Z probe, you must set up servo support below, including
603
-// NUM_SERVOS, Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES.
603
+// For a servo-based Z probe, just set Z_ENDSTOP_SERVO_NR and Z_SERVO_ANGLES above.
604
 //
604
 //
605
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
605
 // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin.
606
 // - Use 5V for powered (usu. inductive) sensors.
606
 // - Use 5V for powered (usu. inductive) sensors.
737
   #define FILAMENT_RUNOUT_SCRIPT "M600"
737
   #define FILAMENT_RUNOUT_SCRIPT "M600"
738
 #endif
738
 #endif
739
 
739
 
740
-//===========================================================================
741
-//============================ Mesh Bed Leveling ============================
742
-//===========================================================================
743
-
744
-//#define MESH_BED_LEVELING    // Enable mesh bed leveling.
745
-
746
-#if ENABLED(MESH_BED_LEVELING)
747
-  #define MESH_INSET 10        // Mesh inset margin on print area
748
-  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited.
749
-  #define MESH_NUM_Y_POINTS 3
750
-  #define MANUAL_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
751
-
752
-  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
753
-
754
-  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
755
-
756
-  #if ENABLED(MANUAL_BED_LEVELING)
757
-    #define MBL_Z_STEP 0.025  // Step size while manually probing Z axis.
758
-  #endif  // MANUAL_BED_LEVELING
759
-
760
-  // Gradually reduce leveling correction until a set height is reached,
761
-  // at which point movement will be level to the machine's XY plane.
762
-  // The height can be set with M420 Z<height>
763
-  #define ENABLE_LEVELING_FADE_HEIGHT
764
-
765
-#endif  // MESH_BED_LEVELING
766
 
740
 
767
 //===========================================================================
741
 //===========================================================================
768
-//============================ Auto Bed Leveling ============================
742
+//=============================== Bed Leveling ==============================
769
 //===========================================================================
743
 //===========================================================================
770
 // @section bedlevel
744
 // @section bedlevel
771
 
745
 
789
  *   Probe several points in a grid.
763
  *   Probe several points in a grid.
790
  *   You specify the rectangle and the density of sample points.
764
  *   You specify the rectangle and the density of sample points.
791
  *   The result is a mesh, best for large or uneven beds.
765
  *   The result is a mesh, best for large or uneven beds.
766
+ *
767
+ * - UBL Unified Bed Leveling
768
+ *   A comprehensive bed leveling system that combines features and benefits from previous
769
+ *   bed leveling system.  The UBL Bed Leveling System also includes an integrated and easy to use
770
+ *   Mesh Generation, Mesh Validation and Mesh Editing system.
771
+ *     - Currently, the UBL Bed Leveling System is only checked out for Cartesian Printers.  But with
772
+ *       that said, it was primarily designed to handle poor quality Delta Printers.  If you feel
773
+ *       adventurous and have a Delta, please post an issue if something doesn't work correctly.
774
+ *       Initially, you will need to reduce your declared bed size so you have a rectangular area to
775
+ *       test on.
792
  */
776
  */
793
 //#define AUTO_BED_LEVELING_3POINT
777
 //#define AUTO_BED_LEVELING_3POINT
794
 //#define AUTO_BED_LEVELING_LINEAR
778
 //#define AUTO_BED_LEVELING_LINEAR
795
 //#define AUTO_BED_LEVELING_BILINEAR
779
 //#define AUTO_BED_LEVELING_BILINEAR
780
+//#define MESH_BED_LEVELING
781
+//#define AUTO_BED_LEVELING_UBL
796
 
782
 
797
 /**
783
 /**
798
  * Enable detailed logging of G28, G29, M48, etc.
784
  * Enable detailed logging of G28, G29, M48, etc.
801
  */
787
  */
802
 //#define DEBUG_LEVELING_FEATURE
788
 //#define DEBUG_LEVELING_FEATURE
803
 
789
 
790
+#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
791
+  // Gradually reduce leveling correction until a set height is reached,
792
+  // at which point movement will be level to the machine's XY plane.
793
+  // The height can be set with M420 Z<height>
794
+  #define ENABLE_LEVELING_FADE_HEIGHT
795
+#endif
796
+
804
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
797
 #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
805
 
798
 
806
   // Set the number of grid points per dimension.
799
   // Set the number of grid points per dimension.
821
 
814
 
822
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
815
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
823
 
816
 
824
-    // Gradually reduce leveling correction until a set height is reached,
825
-    // at which point movement will be level to the machine's XY plane.
826
-    // The height can be set with M420 Z<height>
827
-    #define ENABLE_LEVELING_FADE_HEIGHT
828
-
829
     //
817
     //
830
     // Experimental Subdivision of the grid by Catmull-Rom method.
818
     // Experimental Subdivision of the grid by Catmull-Rom method.
831
     // Synthesizes intermediate points to produce a more detailed mesh.
819
     // Synthesizes intermediate points to produce a more detailed mesh.
849
   #define ABL_PROBE_PT_3_X 170
837
   #define ABL_PROBE_PT_3_X 170
850
   #define ABL_PROBE_PT_3_Y 20
838
   #define ABL_PROBE_PT_3_Y 20
851
 
839
 
852
-#endif
840
+#elif ENABLED(MESH_BED_LEVELING)
841
+
842
+//===========================================================================
843
+//=================================== Mesh ==================================
844
+//===========================================================================
845
+
846
+  #define MANUAL_PROBE_Z_RANGE 4 // Z after Home, bed somewhere below but above 0.0.
847
+  #define MESH_INSET 10          // Mesh inset margin on print area
848
+  #define MESH_NUM_X_POINTS 3    // Don't use more than 7 points per axis, implementation limited.
849
+  #define MESH_NUM_Y_POINTS 3
850
+
851
+  //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest at origin [0,0,0]
852
+
853
+  //#define MANUAL_BED_LEVELING  // Add display menu option for bed leveling.
854
+
855
+  #if ENABLED(MANUAL_BED_LEVELING)
856
+    #define MBL_Z_STEP 0.025     // Step size while manually probing Z axis.
857
+  #endif  // MANUAL_BED_LEVELING
858
+
859
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
860
+
861
+//===========================================================================
862
+//========================= Unified Bed Leveling ============================
863
+//===========================================================================
864
+
865
+  #define UBL_MESH_INSET 1          // Mesh inset margin on print area
866
+  #define UBL_MESH_NUM_X_POINTS 10  // Don't use more than 15 points per axis, implementation limited.
867
+  #define UBL_MESH_NUM_Y_POINTS 10
868
+  #define UBL_PROBE_PT_1_X 39       // These set the probe locations for when UBL does a 3-Point leveling
869
+  #define UBL_PROBE_PT_1_Y 180      // of the mesh.
870
+  #define UBL_PROBE_PT_2_X 39
871
+  #define UBL_PROBE_PT_2_Y 20
872
+  #define UBL_PROBE_PT_3_X 180
873
+  #define UBL_PROBE_PT_3_Y 20
874
+
875
+#endif  // BED_LEVELING
853
 
876
 
854
 /**
877
 /**
855
  * Commands to execute at the end of G29 probing.
878
  * Commands to execute at the end of G29 probing.

+ 47
- 0
Marlin/hex_print_routines.cpp Просмотреть файл

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+
24
+#include "Marlin.h"
25
+#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(M100_FREE_MEMORY_WATCHER)
26
+
27
+#include "hex_print_routines.h"
28
+
29
+void prt_hex_nibble(uint8_t n) {
30
+  if (n <= 9)
31
+    SERIAL_ECHO(n);
32
+  else
33
+    SERIAL_ECHO((char)('A' + n - 10));
34
+  delay(3);
35
+}
36
+
37
+void prt_hex_byte(uint8_t b) {
38
+  prt_hex_nibble((b & 0xF0) >> 4);
39
+  prt_hex_nibble(b & 0x0F);
40
+}
41
+
42
+void prt_hex_word(uint16_t w) {
43
+  prt_hex_byte((w & 0xFF00) >> 8);
44
+  prt_hex_byte(w & 0x0FF);
45
+}
46
+
47
+#endif // AUTO_BED_LEVELING_UBL || M100_FREE_MEMORY_WATCHER

+ 33
- 0
Marlin/hex_print_routines.h Просмотреть файл

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef HEX_PRINT_ROUTINES_H
24
+#define HEX_PRINT_ROUTINES_H
25
+
26
+//
27
+// 3 support routines to print hex numbers.  We can print a nibble, byte and word
28
+//
29
+void prt_hex_nibble(uint8_t n);
30
+void prt_hex_byte(uint8_t b);
31
+void prt_hex_word(uint16_t w);
32
+
33
+#endif // HEX_PRINT_ROUTINES_H

+ 2
- 2
Marlin/printcounter.cpp Просмотреть файл

120
   #if ENABLED(DEBUG_PRINTCOUNTER)
120
   #if ENABLED(DEBUG_PRINTCOUNTER)
121
     SERIAL_ECHOPGM(" (");
121
     SERIAL_ECHOPGM(" (");
122
     SERIAL_ECHO(this->data.printTime);
122
     SERIAL_ECHO(this->data.printTime);
123
-    SERIAL_ECHOPGM(")");
123
+    SERIAL_CHAR(')');
124
   #endif
124
   #endif
125
 
125
 
126
   elapsed = this->data.longestPrint;
126
   elapsed = this->data.longestPrint;
132
   #if ENABLED(DEBUG_PRINTCOUNTER)
132
   #if ENABLED(DEBUG_PRINTCOUNTER)
133
     SERIAL_ECHOPGM(" (");
133
     SERIAL_ECHOPGM(" (");
134
     SERIAL_ECHO(this->data.longestPrint);
134
     SERIAL_ECHO(this->data.longestPrint);
135
-    SERIAL_ECHOPGM(")");
135
+    SERIAL_CHAR(')');
136
   #endif
136
   #endif
137
 
137
 
138
   SERIAL_EOL;
138
   SERIAL_EOL;

+ 13
- 0
Marlin/temperature.cpp Просмотреть файл

24
  * temperature.cpp - temperature control
24
  * temperature.cpp - temperature control
25
  */
25
  */
26
 
26
 
27
+
28
+
27
 #include "Marlin.h"
29
 #include "Marlin.h"
28
 #include "ultralcd.h"
30
 #include "ultralcd.h"
29
 #include "temperature.h"
31
 #include "temperature.h"
666
  *  - Apply filament width to the extrusion rate (may move)
668
  *  - Apply filament width to the extrusion rate (may move)
667
  *  - Update the heated bed PID output value
669
  *  - Update the heated bed PID output value
668
  */
670
  */
671
+
672
+/**
673
+ * The following line SOMETIMES results in the dreaded "unable to find a register to spill in class 'POINTER_REGS'"
674
+ * compile error.
675
+ *    thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
676
+ *
677
+ * This is due to a bug in the C++ compiler used by the Arduino IDE from 1.6.10 to at least 1.8.1.
678
+ *
679
+ * The work around is to add the compiler flag "__attribute__((__optimize__("O2")))" to the declaration for manage_heater()
680
+ */
681
+//void Temperature::manage_heater()  __attribute__((__optimize__("O2")));
669
 void Temperature::manage_heater() {
682
 void Temperature::manage_heater() {
670
 
683
 
671
   if (!temp_meas_ready) return;
684
   if (!temp_meas_ready) return;

+ 2
- 1
Marlin/temperature.h Просмотреть файл

241
     /**
241
     /**
242
      * Call periodically to manage heaters
242
      * Call periodically to manage heaters
243
      */
243
      */
244
-    static void manage_heater();
244
+    //static void manage_heater(); // changed to address compiler error
245
+    static void manage_heater()  __attribute__((__optimize__("O2")));
245
 
246
 
246
     /**
247
     /**
247
      * Preheating hotends
248
      * Preheating hotends

+ 2
- 0
Marlin/thermistornames.h Просмотреть файл

65
   #define THERMISTOR_NAME "Makers Tool"
65
   #define THERMISTOR_NAME "Makers Tool"
66
 #elif THERMISTOR_ID == 70
66
 #elif THERMISTOR_ID == 70
67
   #define THERMISTOR_NAME "Hephestos 2"
67
   #define THERMISTOR_NAME "Hephestos 2"
68
+#elif THERMISTOR_ID == 75
69
+  #define THERMISTOR_NAME "MGB18"
68
 
70
 
69
 // Modified thermistors
71
 // Modified thermistors
70
 #elif THERMISTOR_ID == 51
72
 #elif THERMISTOR_ID == 51

+ 69
- 0
Marlin/thermistortable_75.h Просмотреть файл

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+// Generic Silicon Heat Pad with NTC 100K thermistor ( Beta 25/50 3950K)
24
+//
25
+// Many of the generic silicon heat pads use the MGB18-104F39050L32 Thermistor   It is used for various
26
+// wattage and voltage heat pads.  This table is correct if this part is used.   It has been
27
+// optimized to provide good granularity around the 60 C. and 110 C. which corrisponds to bed temperatures
28
+// for PLA and ABS.  If you are printing higher temperature filament such as nylon you can uncomment
29
+// the higher earlier entries in the table to give better accuracy.  But for speed reasons, if these
30
+// temperatures are not going to be used, it is better to leave them commented out.
31
+
32
+const short temptable_75[][2] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
33
+    { (short) ( 111.06 * OVERSAMPLENR ),  200 }, // v=0.542 r=571.747 res=0.501 degC/count
34
+//  { (short) ( 174.87 * OVERSAMPLENR ),  175 }, // v=0.854 r=967.950 res=0.311 degC/count  These values are valid.  But they serve no
35
+//  { (short) ( 191.64 * OVERSAMPLENR ),  170 }, // v=0.936 r=1082.139 res=0.284 degC/count  purpose.  It is better to delete them so
36
+//  { (short) ( 209.99 * OVERSAMPLENR ),  165 }, // v=1.025 r=1212.472 res=0.260 degC/count  the search is quicker and get to the meaningful
37
+//  { (short) ( 230.02 * OVERSAMPLENR ),  160 }, // v=1.123 r=1361.590 res=0.239 degC/count  part of the table sooner.
38
+//  { (short) ( 251.80 * OVERSAMPLENR ),  155 }, // v=1.230 r=1532.621 res=0.220 degC/count
39
+    { (short) ( 275.43 * OVERSAMPLENR ),  150 }, // v=1.345 r=1729.283 res=0.203 degC/count
40
+//  { (short) ( 300.92 * OVERSAMPLENR ),  145 }, // v=1.469 r=1956.004 res=0.189 degC/coun
41
+    { (short) ( 328.32 * OVERSAMPLENR ),  140 }, // v=1.603 r=2218.081 res=0.176 degC/count
42
+    { (short) ( 388.65 * OVERSAMPLENR ),  130 }, // v=1.898 r=2874.980 res=0.156 degC/count
43
+    { (short) ( 421.39 * OVERSAMPLENR ),  125 }, // v=2.058 r=3286.644 res=0.149 degC/count
44
+    { (short) ( 455.65 * OVERSAMPLENR ),  120 }, // v=2.225 r=3768.002 res=0.143 degC/count
45
+    { (short) ( 491.17 * OVERSAMPLENR ),  115 }, // v=2.398 r=4332.590 res=0.139 degC/count
46
+    { (short) ( 527.68 * OVERSAMPLENR ),  110 }, // v=2.577 r=4996.905 res=0.136 degC/count
47
+    { (short) ( 564.81 * OVERSAMPLENR ),  105 }, // v=2.758 r=5781.120 res=0.134 degC/count
48
+    { (short) ( 602.19 * OVERSAMPLENR ),  100 }, // v=2.940 r=6710.000 res=0.134 degC/count
49
+    { (short) ( 676.03 * OVERSAMPLENR ),   90 }, // v=3.301 r=9131.018 res=0.138 degC/count
50
+    { (short) ( 745.85 * OVERSAMPLENR ),   80 }, // v=3.642 r=12602.693 res=0.150 degC/count
51
+    { (short) ( 778.31 * OVERSAMPLENR ),   75 }, // v=3.800 r=14889.001 res=0.159 degC/count
52
+    { (short) ( 808.75 * OVERSAMPLENR ),   70 }, // v=3.949 r=17658.700 res=0.171 degC/count
53
+    { (short) ( 836.94 * OVERSAMPLENR ),   65 }, // v=4.087 r=21028.040 res=0.185 degC/count
54
+    { (short) ( 862.74 * OVERSAMPLENR ),   60 }, // v=4.213 r=25144.568 res=0.204 degC/count
55
+    { (short) ( 886.08 * OVERSAMPLENR ),   55 }, // v=4.327 r=30196.449 res=0.227 degC/count
56
+    { (short) ( 906.97 * OVERSAMPLENR ),   50 }, // v=4.429 r=36424.838 res=0.255 degC/count
57
+    { (short) ( 941.65 * OVERSAMPLENR ),   40 }, // v=4.598 r=53745.337 res=0.333 degC/count
58
+    { (short) ( 967.76 * OVERSAMPLENR ),   30 }, // v=4.725 r=80880.630 res=0.452 degC/count
59
+    { (short) ( 978.03 * OVERSAMPLENR ),   25 }, // v=4.776 r=100000.000 res=0.535 degC/count
60
+    { (short) ( 981.68 * OVERSAMPLENR ),   23 }, // v=4.793 r=109024.395 res=0.573 degC/count
61
+    { (short) ( 983.41 * OVERSAMPLENR ),   22 }, // v=4.802 r=113875.430 res=0.594 degC/count
62
+    { (short) ( 985.08 * OVERSAMPLENR ),   21 }, // v=4.810 r=118968.955 res=0.616 degC/count
63
+    { (short) ( 986.70 * OVERSAMPLENR ),   20 }, // v=4.818 r=124318.354 res=0.638 degC/count
64
+    { (short) ( 993.94 * OVERSAMPLENR ),   15 }, // v=4.853 r=155431.302 res=0.768 degC/count
65
+    { (short) ( 999.96 * OVERSAMPLENR ),   10 }, // v=4.883 r=195480.023 res=0.934 degC/count
66
+    { (short) (1008.95 * OVERSAMPLENR ),    0 }  // v=4.926 r=314997.575 res=1.418 degC/count
67
+};
68
+
69
+

+ 3
- 0
Marlin/thermistortables.h Просмотреть файл

103
 #if ANY_THERMISTOR_IS(70) // bqh2 stock thermistor
103
 #if ANY_THERMISTOR_IS(70) // bqh2 stock thermistor
104
   #include "thermistortable_70.h"
104
   #include "thermistortable_70.h"
105
 #endif
105
 #endif
106
+#if ANY_THERMISTOR_IS(75) // Many of the generic silicon heat pads use the MGB18-104F39050L32 Thermistor
107
+  #include "thermistortable_75.h"
108
+#endif
106
 #if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
109
 #if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
107
   #include "thermistortable_110.h"
110
   #include "thermistortable_110.h"
108
 #endif
111
 #endif

+ 123
- 3
Marlin/ultralcd.cpp Просмотреть файл

30
 #include "configuration_store.h"
30
 #include "configuration_store.h"
31
 #include "utility.h"
31
 #include "utility.h"
32
 
32
 
33
+extern float zprobe_zoffset;
34
+
33
 #if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
35
 #if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
34
   #include "buzzer.h"
36
   #include "buzzer.h"
35
 #endif
37
 #endif
121
   bool encoderRateMultiplierEnabled;
123
   bool encoderRateMultiplierEnabled;
122
   int32_t lastEncoderMovementMillis;
124
   int32_t lastEncoderMovementMillis;
123
 
125
 
126
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
127
+  extern int UBL_has_control_of_LCD_Panel;
128
+  extern int G29_encoderDiff;
129
+  #endif
130
+
124
   #if HAS_POWER_SWITCH
131
   #if HAS_POWER_SWITCH
125
     extern bool powersupply;
132
     extern bool powersupply;
126
   #endif
133
   #endif
801
 
808
 
802
   #endif //BABYSTEPPING
809
   #endif //BABYSTEPPING
803
 
810
 
811
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
812
+
813
+    float Mesh_Edit_Value, Mesh_Edit_Accumulator; // We round Mesh_Edit_Value to 2.5 decimal places.  So we keep a
814
+                                                  // seperate value that doesn't lose precision.
815
+    static int loop_cnt=0, last_seen_bits;
816
+
817
+    static void _lcd_mesh_fine_tune( const char* msg) {
818
+      static unsigned long last_click=0;
819
+      int  last_digit, movement;
820
+      long int rounded;
821
+
822
+      defer_return_to_status = true;
823
+      if (encoderPosition) {                     // If moving the Encoder wheel very slowly, we just go
824
+        if ( (millis() - last_click) > 500L) {   // up or down by 1 position
825
+          if ( ((int32_t)encoderPosition) > 0 ) {
826
+            encoderPosition = 1;
827
+          }
828
+          else {
829
+            encoderPosition = (uint32_t) -1;
830
+          }
831
+        }
832
+        last_click = millis();
833
+
834
+        Mesh_Edit_Accumulator += ( (float) ((int32_t)encoderPosition)) * .005 / 2.0 ;
835
+        Mesh_Edit_Value       = Mesh_Edit_Accumulator;
836
+        encoderPosition       = 0;
837
+        lcdDrawUpdate       = LCDVIEW_REDRAW_NOW;
838
+
839
+        rounded    = (long int) (Mesh_Edit_Value * 1000.0);
840
+        last_digit = rounded % 5L; //10L;
841
+        rounded    = rounded - last_digit;
842
+        last_digit = rounded % 5L; //10L;
843
+        Mesh_Edit_Value  = ((float) rounded) / 1000.0;
844
+      }
845
+
846
+      if (lcdDrawUpdate) {
847
+        lcd_implementation_drawedit(msg, ftostr43sign( (float) Mesh_Edit_Value  ));
848
+      }
849
+
850
+      if ( !UBL_has_control_of_LCD_Panel && LCD_CLICKED ) {
851
+        UBL_has_control_of_LCD_Panel=1;   // We need to lock the normal LCD Panel System outbecause G29 (and G26) are looking for
852
+        lcd_return_to_status();           // long presses of the Encoder Wheel and the LCD System goes spastic when that happens.
853
+                                          // We will give back control from those routines when the switch is debounced.
854
+      }
855
+    }
856
+
857
+
858
+    void _lcd_mesh_edit() {
859
+      _lcd_mesh_fine_tune( PSTR("Mesh Editor: "));
860
+    }
861
+
862
+    float lcd_mesh_edit() {
863
+      lcd_goto_screen(_lcd_mesh_edit);
864
+      return Mesh_Edit_Value;
865
+    }
866
+
867
+    void lcd_mesh_edit_setup(float inital) {
868
+      Mesh_Edit_Value       = inital;
869
+      Mesh_Edit_Accumulator = inital;
870
+      lcd_goto_screen(_lcd_mesh_edit);
871
+      return ;
872
+    }
873
+
874
+    void _lcd_z_offset_edit() {
875
+      _lcd_mesh_fine_tune( PSTR("Z-Offset: "));
876
+    }
877
+
878
+    float lcd_z_offset_edit() {
879
+      lcd_goto_screen(_lcd_z_offset_edit);
880
+      return Mesh_Edit_Value;
881
+    }
882
+
883
+    void lcd_z_offset_edit_setup(float inital) {
884
+      Mesh_Edit_Value       = inital;
885
+      Mesh_Edit_Accumulator = inital;
886
+      lcd_goto_screen(_lcd_z_offset_edit);
887
+      return ;
888
+    }
889
+
890
+
891
+  #endif // AUTO_BED_LEVELING_UBL
892
+
893
+
804
   /**
894
   /**
805
    * Watch temperature callbacks
895
    * Watch temperature callbacks
806
    */
896
    */
1307
     void _lcd_level_bed_moving() {
1397
     void _lcd_level_bed_moving() {
1308
       if (lcdDrawUpdate) {
1398
       if (lcdDrawUpdate) {
1309
         char msg[10];
1399
         char msg[10];
1310
-        sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS));
1400
+        #if ENABLED(MESH_BED_LEVELING)
1401
+          sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS));
1402
+        #elif ENABLED(AUTO_BED_LEVELING_UBL)
1403
+          sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), (UBL_MESH_NUM_X_POINTS) * (UBL_MESH_NUM_Y_POINTS));
1404
+        #endif
1311
         lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
1405
         lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
1312
       }
1406
       }
1313
 
1407
 
3110
 
3204
 
3111
     lcd_buttons_update();
3205
     lcd_buttons_update();
3112
 
3206
 
3207
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
3208
+      const bool UBL_CONDITION = !UBL_has_control_of_LCD_Panel;
3209
+    #else
3210
+      constexpr bool UBL_CONDITION = true;
3211
+    #endif
3212
+
3113
     // If the action button is pressed...
3213
     // If the action button is pressed...
3114
-    if (LCD_CLICKED) {
3214
+    if (UBL_CONDITION && LCD_CLICKED) {
3115
       if (!wait_for_unclick) {           // If not waiting for a debounce release:
3215
       if (!wait_for_unclick) {           // If not waiting for a debounce release:
3116
         wait_for_unclick = true;         //  Set debounce flag to ignore continous clicks
3216
         wait_for_unclick = true;         //  Set debounce flag to ignore continous clicks
3117
         lcd_clicked = !wait_for_user;    //  Keep the click if not waiting for a user-click
3217
         lcd_clicked = !wait_for_user;    //  Keep the click if not waiting for a user-click
3520
         case encrot2: ENCODER_SPIN(encrot1, encrot3); break;
3620
         case encrot2: ENCODER_SPIN(encrot1, encrot3); break;
3521
         case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
3621
         case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
3522
       }
3622
       }
3623
+      #if ENABLED(AUTO_BED_LEVELING_UBL)
3624
+        if (UBL_has_control_of_LCD_Panel) {
3625
+          G29_encoderDiff = encoderDiff;    // Make the encoder's rotation available to G29's Mesh Editor
3626
+          encoderDiff = 0;                  // We are going to lie to the LCD Panel and claim the encoder
3627
+                                            // wheel has not turned.
3628
+        }
3629
+      #endif
3630
+      lastEncoderBits = enc;
3523
     }
3631
     }
3524
-    lastEncoderBits = enc;
3525
   }
3632
   }
3526
 
3633
 
3527
   #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
3634
   #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
3530
     bool lcd_detected() { return true; }
3637
     bool lcd_detected() { return true; }
3531
   #endif
3638
   #endif
3532
 
3639
 
3640
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
3641
+    void chirp_at_user() {
3642
+      #if ENABLED(LCD_USE_I2C_BUZZER)
3643
+        lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
3644
+      #elif PIN_EXISTS(BEEPER)
3645
+        buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
3646
+      #endif
3647
+    }
3648
+
3649
+    bool G29_lcd_clicked() { return LCD_CLICKED; }
3650
+
3651
+  #endif
3652
+
3533
 #endif // ULTIPANEL
3653
 #endif // ULTIPANEL
3534
 
3654
 
3535
 #endif // ULTRA_LCD
3655
 #endif // ULTRA_LCD

+ 1
- 1
Marlin/ultralcd_impl_DOGM.h Просмотреть файл

320
   lcd_printPGM(PSTR(MSG_PLEASE_RESET));
320
   lcd_printPGM(PSTR(MSG_PLEASE_RESET));
321
 }
321
 }
322
 
322
 
323
-static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
323
+void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
324
 
324
 
325
 //
325
 //
326
 // Status Screen
326
 // Status Screen

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h Просмотреть файл

378
   lcd.clear();
378
   lcd.clear();
379
 }
379
 }
380
 
380
 
381
-static void lcd_implementation_clear() { lcd.clear(); }
381
+void lcd_implementation_clear() { lcd.clear(); }
382
 
382
 
383
 /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
383
 /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
384
 void lcd_printPGM(const char *str) {
384
 void lcd_printPGM(const char *str) {

Загрузка…
Отмена
Сохранить