Browse Source

UBL Mesh Wizard (#21556)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Vert 4 years ago
parent
commit
cb5e6bfef6
No account linked to committer's email address

+ 2
- 0
Marlin/Configuration.h View File

1491
   //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
1491
   //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
1492
                                           // as the Z-Height correction value.
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
 #elif ENABLED(MESH_BED_LEVELING)
1496
 #elif ENABLED(MESH_BED_LEVELING)
1495
 
1497
 
1496
   //===========================================================================
1498
   //===========================================================================

+ 45
- 0
Marlin/src/feature/bedlevel/ubl/ubl.cpp View File

35
 #include "../../../module/planner.h"
35
 #include "../../../module/planner.h"
36
 #include "../../../module/motion.h"
36
 #include "../../../module/motion.h"
37
 #include "../../../module/probe.h"
37
 #include "../../../module/probe.h"
38
+#include "../../../module/temperature.h"
38
 
39
 
39
 #if ENABLED(EXTENSIBLE_UI)
40
 #if ENABLED(EXTENSIBLE_UI)
40
   #include "../../../lcd/extui/ui_api.h"
41
   #include "../../../lcd/extui/ui_api.h"
254
   return !!error_flag;
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
 #endif // AUTO_BED_LEVELING_UBL
302
 #endif // AUTO_BED_LEVELING_UBL

+ 4
- 0
Marlin/src/gcode/gcode.cpp View File

987
         case 1002: M1002(); break;                                // M1002: [INTERNAL] Tool-change and Relative E Move
987
         case 1002: M1002(); break;                                // M1002: [INTERNAL] Tool-change and Relative E Move
988
       #endif
988
       #endif
989
 
989
 
990
+      #if ENABLED(UBL_MESH_WIZARD)
991
+        case 1004: M1004(); break;                                // M1004: UBL Mesh Wizard
992
+      #endif
993
+
990
       #if ENABLED(MAX7219_GCODE)
994
       #if ENABLED(MAX7219_GCODE)
991
         case 7219: M7219(); break;                                // M7219: Set LEDs, columns, and rows
995
         case 7219: M7219(); break;                                // M7219: Set LEDs, columns, and rows
992
       #endif
996
       #endif

+ 4
- 0
Marlin/src/gcode/gcode.h View File

1079
     static void M1002();
1079
     static void M1002();
1080
   #endif
1080
   #endif
1081
 
1081
 
1082
+  #if ENABLED(UBL_MESH_WIZARD)
1083
+    static void M1004();
1084
+  #endif
1085
+
1082
   #if ENABLED(MAX7219_GCODE)
1086
   #if ENABLED(MAX7219_GCODE)
1083
     static void M7219();
1087
     static void M7219();
1084
   #endif
1088
   #endif

+ 1
- 0
Marlin/src/lcd/language/language_en.h View File

166
   PROGMEM Language_Str MSG_UBL_LEVEL_BED                   = _UxGT("Unified Bed Leveling");
166
   PROGMEM Language_Str MSG_UBL_LEVEL_BED                   = _UxGT("Unified Bed Leveling");
167
   PROGMEM Language_Str MSG_LCD_TILTING_MESH                = _UxGT("Tilting Point");
167
   PROGMEM Language_Str MSG_LCD_TILTING_MESH                = _UxGT("Tilting Point");
168
   PROGMEM Language_Str MSG_UBL_MANUAL_MESH                 = _UxGT("Manually Build Mesh");
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
   PROGMEM Language_Str MSG_UBL_BC_INSERT                   = _UxGT("Place Shim & Measure");
170
   PROGMEM Language_Str MSG_UBL_BC_INSERT                   = _UxGT("Place Shim & Measure");
170
   PROGMEM Language_Str MSG_UBL_BC_INSERT2                  = _UxGT("Measure");
171
   PROGMEM Language_Str MSG_UBL_BC_INSERT2                  = _UxGT("Measure");
171
   PROGMEM Language_Str MSG_UBL_BC_REMOVE                   = _UxGT("Remove & Measure Bed");
172
   PROGMEM Language_Str MSG_UBL_BC_REMOVE                   = _UxGT("Remove & Measure Bed");

+ 48
- 1
Marlin/src/lcd/menu/menu_ubl.cpp View File

37
 #include "../../feature/bedlevel/bedlevel.h"
37
 #include "../../feature/bedlevel/bedlevel.h"
38
 
38
 
39
 static int16_t ubl_storage_slot = 0,
39
 static int16_t ubl_storage_slot = 0,
40
-               custom_hotend_temp = 190,
40
+               custom_hotend_temp = 150,
41
                side_points = 3,
41
                side_points = 3,
42
                ubl_fillin_amount = 5,
42
                ubl_fillin_amount = 5,
43
                ubl_height_amount = 1;
43
                ubl_height_amount = 1;
603
 
603
 
604
 #endif
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
  * UBL System submenu
651
  * UBL System submenu
608
  *
652
  *
626
   #if ENABLED(G26_MESH_VALIDATION)
670
   #if ENABLED(G26_MESH_VALIDATION)
627
     SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
671
     SUBMENU(MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step);
628
   #endif
672
   #endif
673
+  #if ENABLED(UBL_MESH_WIZARD)
674
+    SUBMENU(MSG_UBL_MESH_WIZARD, _menu_ubl_mesh_wizard);
675
+  #endif
629
   ACTION_ITEM(MSG_UBL_MESH_EDIT, _ubl_goto_map_screen);
676
   ACTION_ITEM(MSG_UBL_MESH_EDIT, _ubl_goto_map_screen);
630
   SUBMENU(MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
677
   SUBMENU(MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
631
   SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);
678
   SUBMENU(MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);

+ 1
- 1
buildroot/tests/FYSETC_F6 View File

24
         L6470_CHAIN_SCK_PIN 53 L6470_CHAIN_MISO_PIN 49 L6470_CHAIN_MOSI_PIN 40 L6470_CHAIN_SS_PIN 42 \
24
         L6470_CHAIN_SCK_PIN 53 L6470_CHAIN_MISO_PIN 49 L6470_CHAIN_MOSI_PIN 40 L6470_CHAIN_SS_PIN 42 \
25
         'ENABLE_RESET_L64XX_CHIPS(V)' NOOP
25
         'ENABLE_RESET_L64XX_CHIPS(V)' NOOP
26
 opt_enable RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS EEPROM_CHITCHAT \
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
            OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY DELTA_CALIBRATION_MENU
28
            OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY DELTA_CALIBRATION_MENU
29
 exec_test $1 $2 "DELTA, RAMPS, L6470, UBL, Allen Key, EEPROM, OLED_PANEL_TINYBOY2..." "$3"
29
 exec_test $1 $2 "DELTA, RAMPS, L6470, UBL, Allen Key, EEPROM, OLED_PANEL_TINYBOY2..." "$3"
30
 
30
 

Loading…
Cancel
Save