ソースを参照

UBL Menu System 1.1

    /**
     * UBL System submenu
     *
     *  Prepare
     * - Unified Bed Leveling
     *   - Activate UBL
     *   - Deactivate UBL
     *   - Mesh Storage
     *       Memory Slot:
     *       Load Bed Mesh
     *       Save Bed Mesh
     *   - Output Map
     *       Map Type:
     *       Output Bed Mesh Host / Output Bed Mesh CSV
     *   - UBL Tools
     *     - Build Mesh
     *         Build PLA Mesh
     *         Build ABS Mesh
     *       - Build Custom Mesh
     *           Hotend Temp:
     *           Bed Temp:
     *           Build Custom Mesh
     *         Info Screen
     *       - Build Cold Mesh
     *       - Fill-in Mesh
     *           Fill-in Mesh
     *           Smart Fill-in
     *           Manual Fill-in
     *           Info Screen
     *         Continue Bed Mesh
     *         Invalidate All
     *         Invalidate Closest
     *     - Validate Mesh
     *         PLA Mesh Validation
     *         ABS Mesh Validation
     *       - Custom Mesh Validation
     *           Hotend Temp:
     *           Bed Temp:
     *           Validate Mesh
     *         Info Screen
     *     - Edit Mesh
     *         Fine Tune All
     *         Fine Tune Closest
     *       - Adjust Mesh Height
     *           Height Amount:
     *           Adjust Mesh Height
     *         Info Screen
     *     - Mesh Leveling
     *         3-Point Mesh Leveling
     *       - Grid Mesh Leveling
     *           Side points:
     *           Level Mesh
     *         Info Screen
     *   - Output UBL Info
     */
Tannoo 8年前
コミット
66db6c3acc
3個のファイルの変更512行の追加13行の削除
  1. 142
    1
      Marlin/language_en.h
  2. 22
    10
      Marlin/ubl_G29.cpp
  3. 348
    2
      Marlin/ultralcd.cpp

+ 142
- 1
Marlin/language_en.h ファイルの表示

@@ -153,6 +153,145 @@
153 153
 #ifndef MSG_LEVEL_BED
154 154
   #define MSG_LEVEL_BED                       _UxGT("Level bed")
155 155
 #endif
156
+
157
+#if ENABLED(AUTO_BED_LEVELING_UBL)
158
+  #ifndef MSG_UBL_UNHOMED
159
+    #define MSG_UBL_UNHOMED                   _UxGT("Home XYZ first")
160
+  #endif
161
+  #ifndef MSG_UBL_TOOLS
162
+    #define MSG_UBL_TOOLS                     _UxGT("UBL Tools")
163
+  #endif
164
+  #ifndef MSG_UBL_LEVEL_BED
165
+    #define MSG_UBL_LEVEL_BED                 _UxGT("Unified Bed Leveling")
166
+  #endif
167
+  #ifndef MSG_UBL_ACTIVATE_MESH
168
+    #define MSG_UBL_ACTIVATE_MESH             _UxGT("Activate UBL")
169
+  #endif
170
+  #ifndef MSG_UBL_DEACTIVATE_MESH
171
+    #define MSG_UBL_DEACTIVATE_MESH           _UxGT("Deactivate UBL")
172
+  #endif
173
+  #ifndef MSG_UBL_CUSTOM_BED_TEMP
174
+    #define MSG_UBL_CUSTOM_BED_TEMP           _UxGT("Bed Temp")
175
+  #endif
176
+  #ifndef MSG_UBL_SET_BED_TEMP
177
+    #define MSG_UBL_SET_BED_TEMP              _UxGT("Bed Temp")
178
+  #endif
179
+  #ifndef MSG_UBL_CUSTOM_HOTEND_TEMP
180
+    #define MSG_UBL_CUSTOM_HOTEND_TEMP        _UxGT("Hotend Temp")
181
+  #endif
182
+  #ifndef MSG_UBL_SET_HOTEND_TEMP
183
+    #define MSG_UBL_SET_HOTEND_TEMP           _UxGT("Hotend Temp")
184
+  #endif
185
+  #ifndef MSG_UBL_EDIT_CUSTOM_MESH
186
+    #define MSG_UBL_EDIT_CUSTOM_MESH          _UxGT("Edit Custom Mesh")
187
+  #endif
188
+  #ifndef MSG_UBL_BUILD_CUSTOM_MESH
189
+    #define MSG_UBL_BUILD_CUSTOM_MESH         _UxGT("Build Custom Mesh")
190
+  #endif
191
+  #ifndef MSG_UBL_BUILD_MESH_MENU
192
+    #define MSG_UBL_BUILD_MESH_MENU           _UxGT("Build Mesh")
193
+  #endif
194
+  #ifndef MSG_UBL_BUILD_PLA_MESH
195
+    #define MSG_UBL_BUILD_PLA_MESH            _UxGT("Build PLA Mesh")
196
+  #endif
197
+  #ifndef MSG_UBL_BUILD_ABS_MESH
198
+    #define MSG_UBL_BUILD_ABS_MESH            _UxGT("Build ABS Mesh")
199
+  #endif
200
+  #ifndef MSG_UBL_BUILD_COLD_MESH
201
+    #define MSG_UBL_BUILD_COLD_MESH           _UxGT("Build Cold Mesh")
202
+  #endif
203
+  #ifndef MSG_UBL_MESH_HEIGHT_ADJUST
204
+    #define MSG_UBL_MESH_HEIGHT_ADJUST        _UxGT("Adjust Mesh Height")
205
+  #endif
206
+  #ifndef MSG_UBL_MESH_HEIGHT_AMOUNT
207
+    #define MSG_UBL_MESH_HEIGHT_AMOUNT        _UxGT("Height Amount")
208
+  #endif
209
+  #ifndef MSG_UBL_VALIDATE_MESH_MENU
210
+    #define MSG_UBL_VALIDATE_MESH_MENU        _UxGT("Validate Mesh")
211
+  #endif
212
+  #ifndef MSG_UBL_VALIDATE_PLA_MESH
213
+    #define MSG_UBL_VALIDATE_PLA_MESH         _UxGT("Validate PLA Mesh")
214
+  #endif
215
+  #ifndef MSG_UBL_VALIDATE_ABS_MESH
216
+    #define MSG_UBL_VALIDATE_ABS_MESH         _UxGT("Validate ABS Mesh")
217
+  #endif
218
+  #ifndef MSG_UBL_VALIDATE_CUSTOM_MESH
219
+    #define MSG_UBL_VALIDATE_CUSTOM_MESH      _UxGT("Validate Custom Mesh")
220
+  #endif
221
+  #ifndef MSG_UBL_CONTINUE_MESH
222
+    #define MSG_UBL_CONTINUE_MESH             _UxGT("Continue Bed Mesh")
223
+  #endif
224
+  #ifndef MSG_UBL_MESH_LEVELING
225
+    #define MSG_UBL_MESH_LEVELING             _UxGT("Mesh Leveling")
226
+  #endif
227
+  #ifndef MSG_UBL_3POINT_MESH_LEVELING
228
+    #define MSG_UBL_3POINT_MESH_LEVELING      _UxGT("3-Point Leveling")
229
+  #endif
230
+  #ifndef MSG_UBL_GRID_MESH_LEVELING
231
+    #define MSG_UBL_GRID_MESH_LEVELING        _UxGT("Grid Mesh Leveling")
232
+  #endif
233
+  #ifndef MSG_UBL_MESH_LEVEL
234
+    #define MSG_UBL_MESH_LEVEL                _UxGT("Level Mesh")
235
+  #endif
236
+  #ifndef MSG_UBL_SIDE_POINTS
237
+    #define MSG_UBL_SIDE_POINTS               _UxGT("Side Points")
238
+  #endif
239
+  #ifndef MSG_UBL_MAP_TYPE
240
+    #define MSG_UBL_MAP_TYPE                  _UxGT("Map Type")
241
+  #endif
242
+  #ifndef MSG_UBL_OUTPUT_MAP
243
+    #define MSG_UBL_OUTPUT_MAP                _UxGT("Output Mesh Map")
244
+  #endif
245
+  #ifndef MSG_UBL_OUTPUT_MAP_HOST
246
+    #define MSG_UBL_OUTPUT_MAP_HOST           _UxGT("Output for Host")
247
+  #endif
248
+  #ifndef MSG_UBL_OUTPUT_MAP_CSV
249
+    #define MSG_UBL_OUTPUT_MAP_CSV            _UxGT("Output for CSV")
250
+  #endif
251
+  #ifndef MSG_UBL_INFO_UBL
252
+    #define MSG_UBL_INFO_UBL                  _UxGT("Output UBL Info")
253
+  #endif
254
+  #ifndef MSG_UBL_EDIT_MESH_MENU
255
+    #define MSG_UBL_EDIT_MESH_MENU            _UxGT("Edit Mesh")
256
+  #endif
257
+  #ifndef MSG_UBL_FILLIN_AMOUNT
258
+    #define MSG_UBL_FILLIN_AMOUNT             _UxGT("Fill-in Amount")
259
+  #endif
260
+  #ifndef MSG_UBL_MANUAL_FILLIN
261
+    #define MSG_UBL_MANUAL_FILLIN             _UxGT("Manual Fill-in")
262
+  #endif
263
+  #ifndef MSG_UBL_SMART_FILLIN
264
+    #define MSG_UBL_SMART_FILLIN              _UxGT("Smart Fill-in")
265
+  #endif
266
+  #ifndef MSG_UBL_FILLIN_MESH
267
+    #define MSG_UBL_FILLIN_MESH               _UxGT("Fill-in Mesh")
268
+  #endif
269
+  #ifndef MSG_UBL_INVALIDATE_ALL
270
+    #define MSG_UBL_INVALIDATE_ALL            _UxGT("Invalidate All")
271
+  #endif
272
+  #ifndef MSG_UBL_INVALIDATE_CLOSEST
273
+    #define MSG_UBL_INVALIDATE_CLOSEST        _UxGT("Invalidate Closest")
274
+  #endif
275
+  #ifndef MSG_UBL_FINE_TUNE_ALL
276
+    #define MSG_UBL_FINE_TUNE_ALL             _UxGT("Fine Tune All")
277
+  #endif
278
+  #ifndef MSG_UBL_FINE_TUNE_CLOSEST
279
+    #define MSG_UBL_FINE_TUNE_CLOSEST         _UxGT("Fine Tune Closest")
280
+  #endif
281
+  #ifndef MSG_UBL_STORAGE_MESH_MENU
282
+    #define MSG_UBL_STORAGE_MESH_MENU         _UxGT("Mesh Storage")
283
+  #endif
284
+  #ifndef MSG_UBL_STORAGE_SLOT
285
+    #define MSG_UBL_STORAGE_SLOT              _UxGT("Memory Slot")
286
+  #endif
287
+  #ifndef MSG_UBL_LOAD_MESH
288
+    #define MSG_UBL_LOAD_MESH                 _UxGT("Load Bed Mesh")
289
+  #endif
290
+  #ifndef MSG_UBL_SAVE_MESH
291
+    #define MSG_UBL_SAVE_MESH                 _UxGT("Save Bed Mesh")
292
+  #endif
293
+#endif  // AUTO_BED_LEVELING_UBL
294
+
156 295
 #ifndef MSG_MOVING
157 296
   #define MSG_MOVING                          _UxGT("Moving...")
158 297
 #endif
@@ -324,6 +463,9 @@
324 463
 #ifndef MSG_RESTORE_FAILSAFE
325 464
   #define MSG_RESTORE_FAILSAFE                _UxGT("Restore failsafe")
326 465
 #endif
466
+#ifndef MSG_INIT_EEPROM
467
+  #define MSG_INIT_EEPROM                     _UxGT("Initalize Memory")
468
+#endif
327 469
 #ifndef MSG_REFRESH
328 470
   #define MSG_REFRESH                         _UxGT("Refresh")
329 471
 #endif
@@ -590,7 +732,6 @@
590 732
 #ifndef MSG_INFO_PSU
591 733
   #define MSG_INFO_PSU                        _UxGT("Power Supply")
592 734
 #endif
593
-
594 735
 #ifndef MSG_DRIVE_STRENGTH
595 736
   #define MSG_DRIVE_STRENGTH                  _UxGT("Drive Strength")
596 737
 #endif

+ 22
- 10
Marlin/ubl_G29.cpp ファイルの表示

@@ -55,12 +55,16 @@
55 55
   extern float probe_pt(float x, float y, bool, int);
56 56
   extern bool set_probe_deployed(bool);
57 57
   void smart_fill_mesh();
58
+  float measure_business_card_thickness(float &in_height);
59
+  void manually_probe_remaining_mesh(const float &lx, const float &ly, float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map);
58 60
 
59 61
   bool ProbeStay = true;
60 62
 
61
-  #define SIZE_OF_LITTLE_RAISE 0
63
+  #define SIZE_OF_LITTLE_RAISE 1
62 64
   #define BIG_RAISE_NOT_NEEDED 0
63
-  extern void lcd_quick_feedback();
65
+  extern void lcd_status_screen();
66
+  typedef void (*screenFunc_t)();
67
+  extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
64 68
 
65 69
   /**
66 70
    *   G29: Unified Bed Leveling by Roxy
@@ -444,7 +448,7 @@
444 448
             y_pos = current_position[Y_AXIS];
445 449
           }
446 450
 
447
-          const float height = code_seen('H') && code_has_value() ? code_value_float() : Z_CLEARANCE_BETWEEN_PROBES;
451
+          float height = code_seen('H') && code_has_value() ? code_value_float() : Z_CLEARANCE_BETWEEN_PROBES;
448 452
 
449 453
           if (code_seen('B')) {
450 454
             card_thickness = code_has_value() ? code_value_float() : measure_business_card_thickness(height);
@@ -876,7 +880,7 @@
876 880
     SERIAL_PROTOCOLLNPGM(" and take a measurement.");
877 881
   }
878 882
 
879
-  float measure_business_card_thickness(const float &in_height) {
883
+  float measure_business_card_thickness(float &in_height) {
880 884
     ubl.has_control_of_lcd_panel = true;
881 885
     ubl.save_ubl_active_state_and_disable();   // Disable bed level correction for probing
882 886
 
@@ -886,6 +890,8 @@
886 890
 
887 891
     stepper.synchronize();
888 892
     SERIAL_PROTOCOLPGM("Place shim under nozzle.");
893
+    LCD_MESSAGEPGM("Place shim & measure");
894
+    lcd_goto_screen(lcd_status_screen);
889 895
     say_and_take_a_measurement();
890 896
 
891 897
     const float z1 = use_encoder_wheel_to_measure_point();
@@ -893,29 +899,33 @@
893 899
     stepper.synchronize();
894 900
 
895 901
     SERIAL_PROTOCOLPGM("Remove shim.");
902
+    LCD_MESSAGEPGM("Remove & measure");
903
+ 
896 904
     say_and_take_a_measurement();
897 905
 
898 906
     const float z2 = use_encoder_wheel_to_measure_point();
899
-    do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
907
+    do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES);
900 908
 
901 909
     if (g29_verbose_level > 1) {
902 910
       SERIAL_PROTOCOLPGM("Business Card is: ");
903 911
       SERIAL_PROTOCOL_F(abs(z1 - z2), 6);
904 912
       SERIAL_PROTOCOLLNPGM("mm thick.");
905 913
     }
914
+    in_height = current_position[Z_AXIS]; // do manual probing at lower height
906 915
     ubl.has_control_of_lcd_panel = false;
907 916
 
908 917
     ubl.restore_ubl_active_state_and_leave();
909 918
     return abs(z1 - z2);
910 919
   }
911 920
 
912
-  void manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) {
921
+  void manually_probe_remaining_mesh(const float &lx, const float &ly, float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) {
913 922
 
914 923
     ubl.has_control_of_lcd_panel = true;
915 924
     ubl.save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
916 925
     do_blocking_move_to_z(z_clearance);
917 926
     do_blocking_move_to_xy(lx, ly);
918 927
 
928
+    lcd_goto_screen(lcd_status_screen);
919 929
     float last_x = -9999.99, last_y = -9999.99;
920 930
     mesh_index_pair location;
921 931
     do {
@@ -943,6 +953,7 @@
943 953
         do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
944 954
       else
945 955
         do_blocking_move_to_z(z_clearance);
956
+      LCD_MESSAGEPGM("Moving to next");
946 957
 
947 958
       do_blocking_move_to_xy(xProbe, yProbe);
948 959
 
@@ -953,6 +964,8 @@
953 964
       ubl.has_control_of_lcd_panel = true;
954 965
 
955 966
       if (do_ubl_mesh_map) ubl.display_map(map_type);  // show user where we're probing
967
+      if (code_seen('B')) {LCD_MESSAGEPGM("Place shim & measure");}
968
+      else {LCD_MESSAGEPGM("Measure");}
956 969
 
957 970
       while (ubl_lcd_clicked()) delay(50);             // wait for user to release encoder wheel
958 971
       delay(50);                                       // debounce
@@ -1024,6 +1037,7 @@
1024 1037
     repeat_flag = code_seen('R');
1025 1038
     if (repeat_flag) {
1026 1039
       repetition_cnt = code_has_value() ? code_value_int() : (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y);
1040
+      repetition_cnt = min(repetition_cnt, (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y));
1027 1041
       if (repetition_cnt < 1) {
1028 1042
         SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
1029 1043
         return UBL_ERR;
@@ -1056,7 +1070,6 @@
1056 1070
       SERIAL_PROTOCOLLNPGM("Both X & Y locations must be specified.\n");
1057 1071
       err_flag = true;
1058 1072
     }
1059
-
1060 1073
     if (!WITHIN(RAW_X_POSITION(x_pos), X_MIN_POS, X_MAX_POS)) {
1061 1074
       SERIAL_PROTOCOLLNPGM("Invalid X location specified.\n");
1062 1075
       err_flag = true;
@@ -1422,8 +1435,7 @@
1422 1435
     do_blocking_move_to_xy(lx, ly);
1423 1436
     do {
1424 1437
       location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, USE_NOZZLE_AS_REFERENCE, not_done, false);
1425
-                                                                  // It doesn't matter if the probe can't reach this
1426
-                                                                  // location. This is a manual edit of the Mesh Point.
1438
+
1427 1439
       if (location.x_index < 0 && location.y_index < 0) continue; // abort if we can't find any more points.
1428 1440
 
1429 1441
       bit_clear(not_done, location.x_index, location.y_index);  // Mark this location as 'adjusted' so we will find a
@@ -1612,7 +1624,7 @@
1612 1624
       SERIAL_ECHOPGM("Could not complete LSF!");
1613 1625
       return;
1614 1626
     }
1615
-
1627
+    
1616 1628
     if (g29_verbose_level > 3) {
1617 1629
       SERIAL_ECHOPGM("LSF Results A=");
1618 1630
       SERIAL_PROTOCOL_F(lsf_results.A, 7);

+ 348
- 2
Marlin/ultralcd.cpp ファイルの表示

@@ -1674,6 +1674,348 @@ void kill_screen(const char* lcd_msg) {
1674 1674
       END_MENU();
1675 1675
     }
1676 1676
 
1677
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
1678
+
1679
+    void _lcd_ubl_level_bed();
1680
+
1681
+    int UBL_STORAGE_SLOT = 0;
1682
+    int CUSTOM_BED_TEMP = 50;
1683
+    int CUSTOM_HOTEND_TEMP = 190;
1684
+    int SIDE_POINTS = 3;
1685
+    int UBL_FILLIN_AMOUNT = 5;
1686
+    int UBL_HEIGHT_AMOUNT;
1687
+    int map_type;
1688
+
1689
+    char UBL_LCD_GCODE [30];
1690
+
1691
+    /**
1692
+     * UBL Build Custom Mesh Command
1693
+     */
1694
+    void _lcd_ubl_build_custom_mesh() {
1695
+      enqueue_and_echo_command("G28");
1696
+      #if (WATCH_THE_BED)
1697
+      sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), CUSTOM_BED_TEMP);
1698
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1699
+      #endif
1700
+      sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), CUSTOM_HOTEND_TEMP);
1701
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1702
+      enqueue_and_echo_command("G29 P1");
1703
+    }
1704
+
1705
+    /**
1706
+     * UBL Custom Mesh submenu
1707
+     */
1708
+    void _lcd_ubl_custom_mesh() {
1709
+      START_MENU();
1710
+      MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
1711
+      MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &CUSTOM_HOTEND_TEMP, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
1712
+      #if (WATCH_THE_BED)
1713
+      MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &CUSTOM_BED_TEMP, BED_MINTEMP, (BED_MAXTEMP - 5));
1714
+      #endif
1715
+      MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
1716
+      END_MENU();
1717
+    }
1718
+
1719
+    /**
1720
+     * UBL Adjust Mesh Height Command
1721
+     */
1722
+    void _lcd_ubl_adjust_height_cmd() {
1723
+      if (UBL_HEIGHT_AMOUNT < 0) {
1724
+        // Convert to positive for the `sprintf_P` string.
1725
+        UBL_HEIGHT_AMOUNT = (UBL_HEIGHT_AMOUNT - (UBL_HEIGHT_AMOUNT * 2)); // Convert to positive
1726
+        sprintf_P(UBL_LCD_GCODE, PSTR("G29 N Z-.%i"), UBL_HEIGHT_AMOUNT);
1727
+        // Convert back to negative to preserve the user setting.
1728
+        UBL_HEIGHT_AMOUNT = (UBL_HEIGHT_AMOUNT - (UBL_HEIGHT_AMOUNT * 2)); // Convert back to negative
1729
+      }
1730
+      else {
1731
+        sprintf_P(UBL_LCD_GCODE, PSTR("G29 N Z.%i"), UBL_HEIGHT_AMOUNT);
1732
+      }
1733
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1734
+    }
1735
+
1736
+    /**
1737
+     * UBL Adjust Mesh Height submenu
1738
+     */
1739
+    void _lcd_ubl_height_adjust_menu() {
1740
+      START_MENU();
1741
+      MENU_BACK(MSG_UBL_EDIT_MESH_MENU);
1742
+      MENU_ITEM_EDIT(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &UBL_HEIGHT_AMOUNT, -9, 9);
1743
+      MENU_ITEM(function, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_adjust_height_cmd);
1744
+      MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
1745
+      END_MENU();
1746
+    }
1747
+
1748
+    /**
1749
+     * UBL Edit Mesh submenu
1750
+     */
1751
+    void _lcd_ubl_edit_mesh() {
1752
+      START_MENU();
1753
+      MENU_BACK(MSG_UBL_TOOLS);
1754
+      MENU_BACK(MSG_UBL_LEVEL_BED);
1755
+      MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R O"));
1756
+      MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29 P4 O"));
1757
+      MENU_ITEM(submenu, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_height_adjust_menu);
1758
+      MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
1759
+      END_MENU();
1760
+    }
1761
+
1762
+    /**
1763
+     * UBL Validate Custom Mesh Command
1764
+     */
1765
+    void _lcd_ubl_validate_custom_mesh() {
1766
+      enqueue_and_echo_command("G28");
1767
+      #if (WATCH_THE_BED)
1768
+        sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), CUSTOM_BED_TEMP, CUSTOM_HOTEND_TEMP);
1769
+      #else
1770
+        sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B0 H%i P"), CUSTOM_HOTEND_TEMP);
1771
+      #endif
1772
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1773
+    }
1774
+
1775
+    /**
1776
+     * UBL Validate Mesh submenu
1777
+     */
1778
+    void _lcd_ubl_validate_mesh() {
1779
+      START_MENU();
1780
+      MENU_BACK(MSG_UBL_TOOLS);
1781
+      #if (WATCH_THE_BED)
1782
+        MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED)
1783
+          " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
1784
+        MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED)
1785
+          " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
1786
+      #else
1787
+        MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
1788
+        MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
1789
+      #endif
1790
+      MENU_ITEM(function, MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh);
1791
+      MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
1792
+      END_MENU();
1793
+    }
1794
+
1795
+    /**
1796
+     * UBL Grid Leveling Command
1797
+     */
1798
+    void _lcd_ubl_grid_level_cmd() {
1799
+      sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), SIDE_POINTS);
1800
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1801
+    }
1802
+
1803
+    /**
1804
+     * UBL Grid Leveling submenu
1805
+     */
1806
+    void _lcd_ubl_grid_level() {
1807
+      START_MENU();
1808
+      MENU_BACK(MSG_UBL_TOOLS);
1809
+      MENU_ITEM_EDIT(int3, MSG_UBL_SIDE_POINTS, &SIDE_POINTS, 2, 6);
1810
+      MENU_ITEM(function, MSG_UBL_MESH_LEVEL, _lcd_ubl_grid_level_cmd);
1811
+      END_MENU();
1812
+    }
1813
+
1814
+    /**
1815
+     * UBL Mesh Leveling submenu
1816
+     */
1817
+    void _lcd_ubl_mesh_leveling() {
1818
+      START_MENU();
1819
+      MENU_BACK(MSG_UBL_TOOLS);
1820
+      MENU_ITEM(gcode, MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29 T"));
1821
+      MENU_ITEM(submenu, MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level);
1822
+      MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
1823
+      END_MENU();
1824
+    }
1825
+
1826
+    /**
1827
+     * UBL Fill-in Amount Mesh Command
1828
+     */
1829
+    void _lcd_ubl_fillin_amount_cmd() {
1830
+      sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i N"), UBL_FILLIN_AMOUNT);
1831
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1832
+    }
1833
+
1834
+    /**
1835
+     * UBL Smart Fill-in Command
1836
+     */
1837
+    void _lcd_ubl_smart_fillin_cmd() {
1838
+      sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 N O%i"), map_type);
1839
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1840
+    }
1841
+
1842
+    /**
1843
+     * UBL Fill-in Mesh submenu
1844
+     */
1845
+    void _lcd_ubl_fillin_menu() {
1846
+      START_MENU();
1847
+      MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
1848
+      MENU_ITEM_EDIT(int3, MSG_UBL_FILLIN_AMOUNT, &UBL_FILLIN_AMOUNT, 0, 9);
1849
+      MENU_ITEM(function, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_amount_cmd);
1850
+      MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
1851
+      MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B O"));
1852
+      MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
1853
+      END_MENU();
1854
+    }
1855
+
1856
+    void _lcd_ubl_invalidate() {
1857
+      ubl.invalidate();
1858
+      SERIAL_PROTOCOLLNPGM("Mesh invalidated.");
1859
+    }
1860
+
1861
+    /**
1862
+     * UBL Build Mesh submenu
1863
+     */
1864
+    void _lcd_ubl_build_mesh() {
1865
+      int GRID_NUM_POINTS = GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y ;
1866
+      START_MENU();
1867
+      MENU_BACK(MSG_UBL_TOOLS);
1868
+      #if (WATCH_THE_BED)
1869
+        MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR("G28\nM190 S" STRINGIFY(PREHEAT_1_TEMP_BED)
1870
+          "\nM109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\nG29 P1\nM104 S0\nM140 S0"));
1871
+        MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR("G28\nM190 S" STRINGIFY(PREHEAT_1_TEMP_BED)
1872
+          "\nM109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\nG29 P1\nM104 S0\nM140 S0"));
1873
+      #else
1874
+        MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR("G28\nM109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
1875
+          "\nG29 P1\nM104 S0"));
1876
+        MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR("G28\nM109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
1877
+          "\nG29 P1\nM104 S0"));
1878
+      #endif
1879
+      MENU_ITEM(submenu, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh);
1880
+      MENU_ITEM(gcode, MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1"));
1881
+      MENU_ITEM(submenu, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_menu);
1882
+      MENU_ITEM(gcode, MSG_UBL_CONTINUE_MESH, PSTR("G29 P1 C"));
1883
+      MENU_ITEM(function, MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate);
1884
+      MENU_ITEM(gcode, MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29 I"));
1885
+      MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
1886
+      END_MENU();
1887
+    }
1888
+
1889
+    /**
1890
+     * UBL Load Mesh Command
1891
+     */
1892
+    void _lcd_ubl_load_mesh_cmd() {
1893
+      sprintf_P(UBL_LCD_GCODE, PSTR("G29 N L%i"), UBL_STORAGE_SLOT);
1894
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1895
+    }
1896
+
1897
+    /**
1898
+     * UBL Save Mesh Command
1899
+     */
1900
+    void _lcd_ubl_save_mesh_cmd() {
1901
+      sprintf_P(UBL_LCD_GCODE, PSTR("G29 N S%i"), UBL_STORAGE_SLOT);
1902
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1903
+    }
1904
+
1905
+    /**
1906
+     * UBL Mesh Storage submenu
1907
+     */
1908
+    void _lcd_ubl_storage_mesh() {
1909
+      START_MENU();
1910
+      MENU_BACK(MSG_UBL_LEVEL_BED);
1911
+      MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &UBL_STORAGE_SLOT, 0, 9);
1912
+      MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd);
1913
+      MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
1914
+      END_MENU();
1915
+    }
1916
+
1917
+    /**
1918
+     * UBL Output map Command
1919
+     */
1920
+    void _lcd_ubl_output_map_cmd() {
1921
+      sprintf_P(UBL_LCD_GCODE, PSTR("G29 N O%i"), map_type);
1922
+      enqueue_and_echo_command(UBL_LCD_GCODE);
1923
+    }
1924
+
1925
+    /**
1926
+     * UBL Output map submenu
1927
+     */
1928
+    void _lcd_ubl_output_map() {
1929
+      START_MENU();
1930
+      MENU_BACK(MSG_UBL_LEVEL_BED);
1931
+      MENU_ITEM_EDIT(int3, MSG_UBL_MAP_TYPE, &map_type, 0, 1);
1932
+      if (map_type == 0) MENU_ITEM(function, MSG_UBL_OUTPUT_MAP_HOST, _lcd_ubl_output_map_cmd);
1933
+      if (map_type == 1) MENU_ITEM(function, MSG_UBL_OUTPUT_MAP_CSV, _lcd_ubl_output_map_cmd);
1934
+      END_MENU();
1935
+    }
1936
+
1937
+    /**
1938
+     * UBL Tools submenu
1939
+     */
1940
+    void _lcd_ubl_tools_menu() {
1941
+      START_MENU();
1942
+      MENU_BACK(MSG_UBL_LEVEL_BED);
1943
+      MENU_ITEM(submenu, MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh);
1944
+      MENU_ITEM(submenu, MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
1945
+      MENU_ITEM(submenu, MSG_UBL_EDIT_MESH_MENU, _lcd_ubl_edit_mesh);
1946
+      MENU_ITEM(submenu, MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling);
1947
+      END_MENU();
1948
+    }
1949
+
1950
+    /**
1951
+     * UBL System submenu
1952
+     * 
1953
+     *  Prepare
1954
+     * - Unified Bed Leveling
1955
+     *   - Activate UBL
1956
+     *   - Deactivate UBL
1957
+     *   - Mesh Storage
1958
+     *       Memory Slot:
1959
+     *       Load Bed Mesh
1960
+     *       Save Bed Mesh
1961
+     *   - Output Map
1962
+     *       Map Type:
1963
+     *       Output Bed Mesh Host / Output Bed Mesh CSV
1964
+     *   - UBL Tools
1965
+     *     - Build Mesh
1966
+     *         Build PLA Mesh
1967
+     *         Build ABS Mesh
1968
+     *       - Build Custom Mesh
1969
+     *           Hotend Temp:
1970
+     *           Bed Temp:
1971
+     *           Build Custom Mesh
1972
+     *         Info Screen
1973
+     *       - Build Cold Mesh
1974
+     *       - Fill-in Mesh
1975
+     *           Fill-in Mesh
1976
+     *           Smart Fill-in
1977
+     *           Manual Fill-in
1978
+     *           Info Screen
1979
+     *         Continue Bed Mesh
1980
+     *         Invalidate All
1981
+     *         Invalidate Closest
1982
+     *     - Validate Mesh
1983
+     *         PLA Mesh Validation
1984
+     *         ABS Mesh Validation
1985
+     *       - Custom Mesh Validation
1986
+     *           Hotend Temp:
1987
+     *           Bed Temp:
1988
+     *           Validate Mesh
1989
+     *         Info Screen
1990
+     *     - Edit Mesh
1991
+     *         Fine Tune All
1992
+     *         Fine Tune Closest
1993
+     *       - Adjust Mesh Height
1994
+     *           Height Amount:
1995
+     *           Adjust Mesh Height
1996
+     *         Info Screen
1997
+     *     - Mesh Leveling
1998
+     *         3-Point Mesh Leveling
1999
+     *       - Grid Mesh Leveling
2000
+     *           Side points:
2001
+     *           Level Mesh
2002
+     *         Info Screen
2003
+     *   - Output UBL Info
2004
+     */
2005
+
2006
+    void _lcd_ubl_level_bed() {
2007
+      START_MENU();
2008
+      MENU_BACK(MSG_PREPARE);
2009
+      MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A N"));
2010
+      MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D N"));
2011
+      MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
2012
+      MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);
2013
+      MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu);
2014
+      MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W N"));
2015
+      END_MENU();
2016
+    }
2017
+  #endif
2018
+
1677 2019
   #endif // LCD_BED_LEVELING || HAS_ABL
1678 2020
 
1679 2021
   /**
@@ -1716,7 +2058,11 @@ void kill_screen(const char* lcd_msg) {
1716 2058
       #if ENABLED(PROBE_MANUALLY)
1717 2059
         if (!g29_in_progress)
1718 2060
       #endif
1719
-          MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
2061
+      #if ENABLED(AUTO_BED_LEVELING_UBL)
2062
+        MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed);
2063
+      #else
2064
+        MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
2065
+      #endif
1720 2066
 
1721 2067
     #endif
1722 2068
 
@@ -2158,7 +2504,7 @@ void kill_screen(const char* lcd_msg) {
2158 2504
     #endif
2159 2505
 
2160 2506
     MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
2161
-    END_MENU();
2507
+     END_MENU();
2162 2508
   }
2163 2509
 
2164 2510
   /**

読み込み中…
キャンセル
保存