Przeglądaj źródła

UBL Mesh Wizard (#21556)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Vert 3 lat temu
rodzic
commit
cb5e6bfef6
No account linked to committer's email address

+ 2
- 0
Marlin/Configuration.h Wyświetl plik

@@ -1491,6 +1491,8 @@
1491 1491
   //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
1492 1492
                                           // as the Z-Height correction value.
1493 1493
 
1494
+  //#define UBL_MESH_WIZARD         // Run several commands in a row to get a complete mesh
1495
+
1494 1496
 #elif ENABLED(MESH_BED_LEVELING)
1495 1497
 
1496 1498
   //===========================================================================

+ 45
- 0
Marlin/src/feature/bedlevel/ubl/ubl.cpp Wyświetl plik

@@ -35,6 +35,7 @@ unified_bed_leveling ubl;
35 35
 #include "../../../module/planner.h"
36 36
 #include "../../../module/motion.h"
37 37
 #include "../../../module/probe.h"
38
+#include "../../../module/temperature.h"
38 39
 
39 40
 #if ENABLED(EXTENSIBLE_UI)
40 41
   #include "../../../lcd/extui/ui_api.h"
@@ -254,4 +255,48 @@ bool unified_bed_leveling::sanity_check() {
254 255
   return !!error_flag;
255 256
 }
256 257
 
258
+#if ENABLED(UBL_MESH_WIZARD)
259
+
260
+  /**
261
+   * M1004: UBL Mesh Wizard - One-click mesh creation with or without a probe
262
+   */
263
+  void GcodeSuite::M1004() {
264
+
265
+    #define ALIGN_GCODE TERN(Z_STEPPER_AUTO_ALIGN, "G34", "")
266
+    #define PROBE_GCODE TERN(HAS_BED_PROBE, "G29P1\nG29P3", "G29P4R255")
267
+
268
+    #if HAS_HOTEND
269
+      if (parser.seenval('H')) {                          // Handle H# parameter to set Hotend temp
270
+        const celsius_t hotend_temp = parser.value_int(); // Marlin never sends itself F or K, always C
271
+        thermalManager.setTargetHotend(hotend_temp, 0);
272
+        thermalManager.wait_for_hotend(false);
273
+      }
274
+    #endif
275
+
276
+    #if HAS_HEATED_BED
277
+      if (parser.seenval('B')) {                        // Handle B# parameter to set Bed temp
278
+        const celsius_t bed_temp = parser.value_int();  // Marlin never sends itself F or K, always C
279
+        thermalManager.setTargetBed(bed_temp);
280
+        thermalManager.wait_for_bed(false);
281
+      }
282
+    #endif
283
+
284
+    process_subcommands_now_P(G28_STR);               // Home
285
+    process_subcommands_now_P(PSTR(ALIGN_GCODE "\n"   // Align multi z axis if available
286
+                                   PROBE_GCODE "\n"   // Build mesh with available hardware
287
+                                   "G29P3\nG29P3"));  // Ensure mesh is complete by running smart fill twice
288
+
289
+    if (parser.seenval('S')) {
290
+      char umw_gcode[32];
291
+      sprintf_P(umw_gcode, PSTR("G29S%i"), parser.value_int());
292
+      queue.inject(umw_gcode);
293
+    }
294
+
295
+    process_subcommands_now_P(PSTR("G29A\nG29F10\n"   // Set UBL Active & Fade 10
296
+                                   "M140S0\nM104S0\n" // Turn off heaters
297
+                                   "M500"));          // Store settings
298
+  }
299
+
300
+#endif // UBL_MESH_WIZARD
301
+
257 302
 #endif // AUTO_BED_LEVELING_UBL

+ 4
- 0
Marlin/src/gcode/gcode.cpp Wyświetl plik

@@ -987,6 +987,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
987 987
         case 1002: M1002(); break;                                // M1002: [INTERNAL] Tool-change and Relative E Move
988 988
       #endif
989 989
 
990
+      #if ENABLED(UBL_MESH_WIZARD)
991
+        case 1004: M1004(); break;                                // M1004: UBL Mesh Wizard
992
+      #endif
993
+
990 994
       #if ENABLED(MAX7219_GCODE)
991 995
         case 7219: M7219(); break;                                // M7219: Set LEDs, columns, and rows
992 996
       #endif

+ 4
- 0
Marlin/src/gcode/gcode.h Wyświetl plik

@@ -1079,6 +1079,10 @@ private:
1079 1079
     static void M1002();
1080 1080
   #endif
1081 1081
 
1082
+  #if ENABLED(UBL_MESH_WIZARD)
1083
+    static void M1004();
1084
+  #endif
1085
+
1082 1086
   #if ENABLED(MAX7219_GCODE)
1083 1087
     static void M7219();
1084 1088
   #endif

+ 1
- 0
Marlin/src/lcd/language/language_en.h Wyświetl plik

@@ -166,6 +166,7 @@ namespace Language_en {
166 166
   PROGMEM Language_Str MSG_UBL_LEVEL_BED                   = _UxGT("Unified Bed Leveling");
167 167
   PROGMEM Language_Str MSG_LCD_TILTING_MESH                = _UxGT("Tilting Point");
168 168
   PROGMEM Language_Str MSG_UBL_MANUAL_MESH                 = _UxGT("Manually Build Mesh");
169
+  PROGMEM Language_Str MSG_UBL_MESH_WIZARD                 = _UxGT("UBL Mesh Wizard");
169 170
   PROGMEM Language_Str MSG_UBL_BC_INSERT                   = _UxGT("Place Shim & Measure");
170 171
   PROGMEM Language_Str MSG_UBL_BC_INSERT2                  = _UxGT("Measure");
171 172
   PROGMEM Language_Str MSG_UBL_BC_REMOVE                   = _UxGT("Remove & Measure Bed");

+ 48
- 1
Marlin/src/lcd/menu/menu_ubl.cpp Wyświetl plik

@@ -37,7 +37,7 @@
37 37
 #include "../../feature/bedlevel/bedlevel.h"
38 38
 
39 39
 static int16_t ubl_storage_slot = 0,
40
-               custom_hotend_temp = 190,
40
+               custom_hotend_temp = 150,
41 41
                side_points = 3,
42 42
                ubl_fillin_amount = 5,
43 43
                ubl_height_amount = 1;
@@ -603,6 +603,50 @@ void _menu_ubl_tools() {
603 603
 
604 604
 #endif
605 605
 
606
+#if ENABLED(UBL_MESH_WIZARD)
607
+
608
+  /**
609
+   * UBL Mesh Wizard - One-click mesh creation with or without a probe
610
+   */
611
+  void _lcd_ubl_mesh_wizard() {
612
+    char ubl_lcd_gcode[30];
613
+    #if HAS_HEATED_BED && HAS_HOTEND
614
+      sprintf_P(ubl_lcd_gcode, PSTR("M1004B%iH%iS%i"), custom_bed_temp, custom_hotend_temp, ubl_storage_slot);
615
+    #elif HAS_HOTEND
616
+      sprintf_P(ubl_lcd_gcode, PSTR("M1004H%iS%i"), custom_hotend_temp, ubl_storage_slot);
617
+    #else
618
+      sprintf_P(ubl_lcd_gcode, PSTR("M1004S%i"), ubl_storage_slot);
619
+    #endif
620
+    queue.inject(ubl_lcd_gcode);
621
+  }
622
+
623
+  void _menu_ubl_mesh_wizard() {
624
+    const int16_t total_slots = settings.calc_num_meshes();
625
+    START_MENU();
626
+    BACK_ITEM(MSG_UBL_LEVEL_BED);
627
+
628
+    #if HAS_HOTEND
629
+      EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, thermalManager.hotend_max_target(0));
630
+    #endif
631
+
632
+    #if HAS_HEATED_BED
633
+      EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET);
634
+    #endif
635
+
636
+    EDIT_ITEM(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, total_slots);
637
+
638
+    ACTION_ITEM(MSG_UBL_MESH_WIZARD, _lcd_ubl_mesh_wizard);
639
+
640
+    #if ENABLED(G26_MESH_VALIDATION)
641
+      SUBMENU(MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
642
+    #endif
643
+
644
+    ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status);
645
+    END_MENU();
646
+  }
647
+
648
+#endif
649
+
606 650
 /**
607 651
  * UBL System submenu
608 652
  *
@@ -626,6 +670,9 @@ void _lcd_ubl_level_bed() {
626 670
   #if ENABLED(G26_MESH_VALIDATION)
627 671
     SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
628 672
   #endif
673
+  #if ENABLED(UBL_MESH_WIZARD)
674
+    SUBMENU(MSG_UBL_MESH_WIZARD, _menu_ubl_mesh_wizard);
675
+  #endif
629 676
   ACTION_ITEM(MSG_UBL_MESH_EDIT, _ubl_goto_map_screen);
630 677
   SUBMENU(MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
631 678
   SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);

+ 1
- 1
buildroot/tests/FYSETC_F6 Wyświetl plik

@@ -24,7 +24,7 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \
24 24
         L6470_CHAIN_SCK_PIN 53 L6470_CHAIN_MISO_PIN 49 L6470_CHAIN_MOSI_PIN 40 L6470_CHAIN_SS_PIN 42 \
25 25
         'ENABLE_RESET_L64XX_CHIPS(V)' NOOP
26 26
 opt_enable RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS EEPROM_CHITCHAT \
27
-           Z_PROBE_ALLEN_KEY AUTO_BED_LEVELING_UBL \
27
+           Z_PROBE_ALLEN_KEY AUTO_BED_LEVELING_UBL UBL_MESH_WIZARD \
28 28
            OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY DELTA_CALIBRATION_MENU
29 29
 exec_test $1 $2 "DELTA, RAMPS, L6470, UBL, Allen Key, EEPROM, OLED_PANEL_TINYBOY2..." "$3"
30 30
 

Ładowanie…
Anuluj
Zapisz