Browse Source

Probe Wizard XY position (#20167)

wmariz 4 years ago
parent
commit
5768ee0f9e
No account linked to committer's email address

+ 2
- 1
Marlin/Configuration_adv.h View File

@@ -1085,6 +1085,7 @@
1085 1085
     //#define PROBE_OFFSET_WIZARD
1086 1086
     #if ENABLED(PROBE_OFFSET_WIZARD)
1087 1087
       #define PROBE_OFFSET_START -4.0   // Estimated nozzle-to-probe Z offset, plus a little extra
1088
+      //#define PROBE_OFFSET_WIZARD_XY_POS XY_CENTER // Set a convenient position to do the measurement
1088 1089
     #endif
1089 1090
   #endif
1090 1091
 
@@ -3447,7 +3448,7 @@
3447 3448
   #define GANTRY_CALIBRATION_FEEDRATE         500     // Feedrate for correction move
3448 3449
   //#define GANTRY_CALIBRATION_TO_MIN                 // Enable to calibrate Z in the MIN direction
3449 3450
 
3450
-  //#define GANTRY_CALIBRATION_SAFE_POSITION  { X_CENTER, Y_CENTER } // Safe position for nozzle
3451
+  //#define GANTRY_CALIBRATION_SAFE_POSITION XY_CENTER // Safe position for nozzle
3451 3452
   //#define GANTRY_CALIBRATION_XY_PARK_FEEDRATE 3000  // XY Park Feedrate - MMM
3452 3453
   //#define GANTRY_CALIBRATION_COMMANDS_PRE   ""
3453 3454
   #define GANTRY_CALIBRATION_COMMANDS_POST  "G28"     // G28 highly recommended to ensure an accurate position

+ 1
- 0
Marlin/src/inc/Conditionals_post.h View File

@@ -100,6 +100,7 @@
100 100
 #define _Y_HALF_BED ((Y_BED_SIZE) / 2)
101 101
 #define X_CENTER TERN(BED_CENTER_AT_0_0, 0, _X_HALF_BED)
102 102
 #define Y_CENTER TERN(BED_CENTER_AT_0_0, 0, _Y_HALF_BED)
103
+#define XY_CENTER { X_CENTER, Y_CENTER }
103 104
 
104 105
 // Get the linear boundaries of the bed
105 106
 #define X_MIN_BED (X_CENTER - _X_HALF_BED)

+ 1
- 1
Marlin/src/lcd/marlinui.h View File

@@ -622,7 +622,7 @@ public:
622 622
   //
623 623
   // Special handling if a move is underway
624 624
   //
625
-  #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
625
+  #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)) || (ENABLED(PROBE_OFFSET_WIZARD) && defined(PROBE_OFFSET_WIZARD_XY_POS))
626 626
     #define LCD_HAS_WAIT_FOR_MOVE 1
627 627
     static bool wait_for_move;
628 628
   #else

+ 1
- 1
Marlin/src/lcd/menu/menu.h View File

@@ -220,7 +220,7 @@ void _lcd_draw_homing();
220 220
 #endif
221 221
 
222 222
 #if ENABLED(PROBE_OFFSET_WIZARD)
223
-  void goto_probe_offset_wizard();
223
+  void home_and_goto_probe_offset_wizard();
224 224
 #endif
225 225
 
226 226
 #if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))

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

@@ -488,7 +488,7 @@ void menu_backlash();
488 488
       EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
489 489
 
490 490
       #if ENABLED(PROBE_OFFSET_WIZARD)
491
-        SUBMENU(MSG_PROBE_WIZARD, goto_probe_offset_wizard);
491
+        SUBMENU(MSG_PROBE_WIZARD, home_and_goto_probe_offset_wizard);
492 492
       #endif
493 493
 
494 494
       END_MENU();

+ 22
- 11
Marlin/src/lcd/menu/menu_probe_offset.cpp View File

@@ -36,6 +36,7 @@
36 36
 
37 37
 #include "menu_item.h"
38 38
 #include "menu_addon.h"
39
+#include "../../gcode/queue.h"
39 40
 #include "../../module/motion.h"
40 41
 #include "../../module/planner.h"
41 42
 #include "../../module/probe.h"
@@ -120,22 +121,32 @@ void probe_offset_wizard_menu() {
120 121
   END_MENU();
121 122
 }
122 123
 
123
-void goto_probe_offset_wizard() {
124
-  ui.defer_status_screen();
125
-
126
-  prepare_for_calibration();
124
+#ifdef PROBE_OFFSET_WIZARD_XY_POS
125
+
126
+  #define HAS_PROBE_OFFSET_WIZARD_XY_POS 1
127
+
128
+  inline void goto_probe_offset_wizard() {
129
+    if (ui.wait_for_move) return;
130
+    constexpr xy_pos_t wizard_pos = PROBE_OFFSET_WIZARD_XY_POS;
131
+    current_position = wizard_pos;
132
+    ui.wait_for_move = true;
133
+    line_to_current_position(MMM_TO_MMS(HOMING_FEEDRATE_XY)); // Could invoke idle()
134
+    ui.wait_for_move = false;
135
+    ui.synchronize();
136
+    prepare_for_calibration();
137
+    probe.offset.z = PROBE_OFFSET_START;
138
+    ui.goto_screen(probe_offset_wizard_menu);
139
+    ui.defer_status_screen();
140
+  }
127 141
 
128
-  probe.offset.z = PROBE_OFFSET_START;
142
+#endif
129 143
 
130
-  set_all_unhomed();
144
+void home_and_goto_probe_offset_wizard() {
131 145
   queue.inject_P(G28_STR);
132
-
133 146
   ui.goto_screen([]{
134 147
     _lcd_draw_homing();
135
-    if (all_axes_homed()) {
136
-      ui.goto_screen(probe_offset_wizard_menu);
137
-      ui.defer_status_screen();
138
-    }
148
+    if (all_axes_homed())
149
+      ui.goto_screen(TERN(HAS_PROBE_OFFSET_WIZARD_XY_POS, goto_probe_offset_wizard, probe_offset_wizard_menu));
139 150
   });
140 151
 }
141 152
 

Loading…
Cancel
Save