Browse Source

Fix usage, commentary of MANUAL_PROBE_START_Z, Z_AFTER_PROBING (#21692)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
pinchies 3 years ago
parent
commit
a1ee5124d3
No account linked to committer's email address

+ 5
- 1
Marlin/Configuration.h View File

@@ -934,7 +934,6 @@
934 934
  * or (with LCD_BED_LEVELING) the LCD controller.
935 935
  */
936 936
 //#define PROBE_MANUALLY
937
-//#define MANUAL_PROBE_START_Z 0.2
938 937
 
939 938
 /**
940 939
  * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
@@ -1409,6 +1408,11 @@
1409 1408
  */
1410 1409
 //#define DEBUG_LEVELING_FEATURE
1411 1410
 
1411
+#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL, PROBE_MANUALLY)
1412
+  // Set a height for the start of manual adjustment
1413
+  #define MANUAL_PROBE_START_Z 0.2  // (mm) Comment out to use the last-measured height
1414
+#endif
1415
+
1412 1416
 #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
1413 1417
   // Gradually reduce leveling correction until a set height is reached,
1414 1418
   // at which point movement will be level to the machine's XY plane.

+ 15
- 15
Marlin/src/feature/bedlevel/bedlevel.cpp View File

@@ -213,27 +213,27 @@ void reset_bed_level() {
213 213
 
214 214
   void _manual_goto_xy(const xy_pos_t &pos) {
215 215
 
216
+    // Get the resting Z position for after the XY move
216 217
     #ifdef MANUAL_PROBE_START_Z
217
-      constexpr float startz = _MAX(0, MANUAL_PROBE_START_Z);
218
-      #if MANUAL_PROBE_HEIGHT > 0
219
-        do_blocking_move_to_xy_z(pos, MANUAL_PROBE_HEIGHT);
220
-        do_blocking_move_to_z(startz);
221
-      #else
222
-        do_blocking_move_to_xy_z(pos, startz);
223
-      #endif
224
-    #elif MANUAL_PROBE_HEIGHT > 0
225
-      const float prev_z = current_position.z;
226
-      do_blocking_move_to_xy_z(pos, MANUAL_PROBE_HEIGHT);
227
-      do_blocking_move_to_z(prev_z);
218
+      constexpr float finalz = _MAX(0, MANUAL_PROBE_START_Z); // If a MANUAL_PROBE_START_Z value is set, always respect it
228 219
     #else
229
-      do_blocking_move_to_xy(pos);
220
+      #warning "It's recommended to set some MANUAL_PROBE_START_Z value for manual leveling."
221
+    #endif
222
+    #if Z_CLEARANCE_BETWEEN_MANUAL_PROBES > 0     // A probe/obstacle clearance exists so there is a raise:
223
+      #ifndef MANUAL_PROBE_START_Z
224
+        const float finalz = current_position.z;  // - Use the current Z for starting-Z if no MANUAL_PROBE_START_Z was provided
225
+      #endif
226
+      do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_MANUAL_PROBES); // - Raise Z, then move to the new XY
227
+      do_blocking_move_to_z(finalz);              // - Lower down to the starting Z height, ready for adjustment!
228
+    #elif defined(MANUAL_PROBE_START_Z)           // A starting-Z was provided, but there's no raise:
229
+      do_blocking_move_to_xy_z(pos, finalz);      // - Move in XY then down to the starting Z height, ready for adjustment!
230
+    #else                                         // Zero raise and no starting Z height either:
231
+      do_blocking_move_to_xy(pos);                // - Move over with no raise, ready for adjustment!
230 232
     #endif
231
-
232
-    current_position = pos;
233 233
 
234 234
     TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
235 235
   }
236 236
 
237
-#endif
237
+#endif // MESH_BED_LEVELING || PROBE_MANUALLY
238 238
 
239 239
 #endif // HAS_LEVELING

+ 13
- 3
Marlin/src/gcode/bedlevel/mbl/G29.cpp View File

@@ -100,7 +100,11 @@ void GcodeSuite::G29() {
100 100
       // For each G29 S2...
101 101
       if (mbl_probe_index == 0) {
102 102
         // Move close to the bed before the first point
103
-        do_blocking_move_to_z(MANUAL_PROBE_START_Z);
103
+        do_blocking_move_to_z(0.4f
104
+          #ifdef MANUAL_PROBE_START_Z
105
+            + (MANUAL_PROBE_START_Z) - 0.4f
106
+          #endif
107
+        );
104 108
       }
105 109
       else {
106 110
         // Save Z for the previous mesh position
@@ -116,8 +120,14 @@ void GcodeSuite::G29() {
116 120
         _manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] });
117 121
       }
118 122
       else {
119
-        // One last "return to the bed" (as originally coded) at completion
120
-        current_position.z = MANUAL_PROBE_HEIGHT;
123
+        // Move to the after probing position
124
+        current_position.z = (
125
+          #ifdef Z_AFTER_PROBING
126
+            Z_AFTER_PROBING
127
+          #else
128
+            Z_CLEARANCE_BETWEEN_MANUAL_PROBES
129
+          #endif
130
+        );
121 131
         line_to_current_position();
122 132
         planner.synchronize();
123 133
 

+ 6
- 12
Marlin/src/inc/Conditionals_LCD.h View File

@@ -788,14 +788,6 @@
788 788
   #endif
789 789
 #endif // FILAMENT_RUNOUT_SENSOR
790 790
 
791
-#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
792
-  #undef PROBE_MANUALLY
793
-#endif
794
-
795
-#if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
796
-  #define PROBE_SELECTED 1
797
-#endif
798
-
799 791
 #if HAS_BED_PROBE
800 792
   #if DISABLED(NOZZLE_AS_PROBE)
801 793
     #define HAS_PROBE_XY_OFFSET 1
@@ -865,14 +857,16 @@
865 857
     #define PLANNER_LEVELING 1
866 858
   #endif
867 859
 #endif
868
-#if EITHER(HAS_ABL_OR_UBL, Z_MIN_PROBE_REPEATABILITY_TEST)
869
-  #define HAS_PROBING_PROCEDURE 1
870
-#endif
871 860
 #if !HAS_LEVELING
872
-  #undef PROBE_MANUALLY
873 861
   #undef RESTORE_LEVELING_AFTER_G28
874 862
   #undef ENABLE_LEVELING_AFTER_G28
875 863
 #endif
864
+#if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
865
+  #undef PROBE_MANUALLY
866
+#endif
867
+#if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
868
+  #define PROBE_SELECTED 1
869
+#endif
876 870
 
877 871
 #ifdef GRID_MAX_POINTS_X
878 872
   #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))

+ 10
- 4
Marlin/src/inc/Conditionals_post.h View File

@@ -2910,9 +2910,9 @@
2910 2910
     #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
2911 2911
   #endif
2912 2912
   #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT
2913
-    #define MANUAL_PROBE_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
2913
+    #define Z_CLEARANCE_BETWEEN_MANUAL_PROBES Z_CLEARANCE_BETWEEN_PROBES
2914 2914
   #else
2915
-    #define MANUAL_PROBE_HEIGHT Z_HOMING_HEIGHT
2915
+    #define Z_CLEARANCE_BETWEEN_MANUAL_PROBES Z_HOMING_HEIGHT
2916 2916
   #endif
2917 2917
   #ifndef Z_CLEARANCE_MULTI_PROBE
2918 2918
     #define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES
@@ -2922,8 +2922,14 @@
2922 2922
   #endif
2923 2923
 #endif
2924 2924
 
2925
-#if !defined(MANUAL_PROBE_START_Z) && defined(Z_CLEARANCE_BETWEEN_PROBES)
2926
-  #define MANUAL_PROBE_START_Z Z_CLEARANCE_BETWEEN_PROBES
2925
+// Define a starting height for measuring manual probe points
2926
+#ifndef MANUAL_PROBE_START_Z
2927
+  #if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)
2928
+    // Leave MANUAL_PROBE_START_Z undefined so the prior Z height will be used.
2929
+    // Note: If Z_CLEARANCE_BETWEEN_MANUAL_PROBES is 0 there will be no raise between points
2930
+  #elif ENABLED(AUTO_BED_LEVELING_UBL) && defined(Z_CLEARANCE_BETWEEN_PROBES)
2931
+    #define MANUAL_PROBE_START_Z Z_CLEARANCE_BETWEEN_PROBES
2932
+  #endif
2927 2933
 #endif
2928 2934
 
2929 2935
 #ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation

+ 3
- 3
Marlin/src/lcd/menu/menu_bed_leveling.cpp View File

@@ -63,16 +63,16 @@
63 63
   // and allow the command queue to be processed.
64 64
   //
65 65
   // When G29 finishes the last move:
66
-  // - Raise Z to the "manual probe height"
66
+  // - Raise Z to the "Z after probing" height
67 67
   // - Don't return until done.
68 68
   //
69 69
   // ** This blocks the command queue! **
70 70
   //
71 71
   void _lcd_level_bed_done() {
72 72
     if (!ui.wait_for_move) {
73
-      #if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING)
73
+      #if Z_AFTER_PROBING > 0 && DISABLED(MESH_BED_LEVELING)
74 74
         // Display "Done" screen and wait for moves to complete
75
-        line_to_z(MANUAL_PROBE_HEIGHT);
75
+        line_to_z(Z_AFTER_PROBING);
76 76
         ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE));
77 77
       #endif
78 78
       ui.goto_previous_screen_no_defer();

Loading…
Cancel
Save