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 4 years ago
parent
commit
a1ee5124d3
No account linked to committer's email address

+ 5
- 1
Marlin/Configuration.h View File

934
  * or (with LCD_BED_LEVELING) the LCD controller.
934
  * or (with LCD_BED_LEVELING) the LCD controller.
935
  */
935
  */
936
 //#define PROBE_MANUALLY
936
 //#define PROBE_MANUALLY
937
-//#define MANUAL_PROBE_START_Z 0.2
938
 
937
 
939
 /**
938
 /**
940
  * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
939
  * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
1409
  */
1408
  */
1410
 //#define DEBUG_LEVELING_FEATURE
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
 #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
1416
 #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
1413
   // Gradually reduce leveling correction until a set height is reached,
1417
   // Gradually reduce leveling correction until a set height is reached,
1414
   // at which point movement will be level to the machine's XY plane.
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
 
213
 
214
   void _manual_goto_xy(const xy_pos_t &pos) {
214
   void _manual_goto_xy(const xy_pos_t &pos) {
215
 
215
 
216
+    // Get the resting Z position for after the XY move
216
     #ifdef MANUAL_PROBE_START_Z
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
     #else
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
     #endif
232
     #endif
231
-
232
-    current_position = pos;
233
 
233
 
234
     TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
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
 #endif // HAS_LEVELING
239
 #endif // HAS_LEVELING

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

100
       // For each G29 S2...
100
       // For each G29 S2...
101
       if (mbl_probe_index == 0) {
101
       if (mbl_probe_index == 0) {
102
         // Move close to the bed before the first point
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
       else {
109
       else {
106
         // Save Z for the previous mesh position
110
         // Save Z for the previous mesh position
116
         _manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] });
120
         _manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] });
117
       }
121
       }
118
       else {
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
         line_to_current_position();
131
         line_to_current_position();
122
         planner.synchronize();
132
         planner.synchronize();
123
 
133
 

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

788
   #endif
788
   #endif
789
 #endif // FILAMENT_RUNOUT_SENSOR
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
 #if HAS_BED_PROBE
791
 #if HAS_BED_PROBE
800
   #if DISABLED(NOZZLE_AS_PROBE)
792
   #if DISABLED(NOZZLE_AS_PROBE)
801
     #define HAS_PROBE_XY_OFFSET 1
793
     #define HAS_PROBE_XY_OFFSET 1
865
     #define PLANNER_LEVELING 1
857
     #define PLANNER_LEVELING 1
866
   #endif
858
   #endif
867
 #endif
859
 #endif
868
-#if EITHER(HAS_ABL_OR_UBL, Z_MIN_PROBE_REPEATABILITY_TEST)
869
-  #define HAS_PROBING_PROCEDURE 1
870
-#endif
871
 #if !HAS_LEVELING
860
 #if !HAS_LEVELING
872
-  #undef PROBE_MANUALLY
873
   #undef RESTORE_LEVELING_AFTER_G28
861
   #undef RESTORE_LEVELING_AFTER_G28
874
   #undef ENABLE_LEVELING_AFTER_G28
862
   #undef ENABLE_LEVELING_AFTER_G28
875
 #endif
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
 #ifdef GRID_MAX_POINTS_X
871
 #ifdef GRID_MAX_POINTS_X
878
   #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
872
   #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))

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

2910
     #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
2910
     #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
2911
   #endif
2911
   #endif
2912
   #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT
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
   #else
2914
   #else
2915
-    #define MANUAL_PROBE_HEIGHT Z_HOMING_HEIGHT
2915
+    #define Z_CLEARANCE_BETWEEN_MANUAL_PROBES Z_HOMING_HEIGHT
2916
   #endif
2916
   #endif
2917
   #ifndef Z_CLEARANCE_MULTI_PROBE
2917
   #ifndef Z_CLEARANCE_MULTI_PROBE
2918
     #define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES
2918
     #define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES
2922
   #endif
2922
   #endif
2923
 #endif
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
 #endif
2933
 #endif
2928
 
2934
 
2929
 #ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation
2935
 #ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation

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

63
   // and allow the command queue to be processed.
63
   // and allow the command queue to be processed.
64
   //
64
   //
65
   // When G29 finishes the last move:
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
   // - Don't return until done.
67
   // - Don't return until done.
68
   //
68
   //
69
   // ** This blocks the command queue! **
69
   // ** This blocks the command queue! **
70
   //
70
   //
71
   void _lcd_level_bed_done() {
71
   void _lcd_level_bed_done() {
72
     if (!ui.wait_for_move) {
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
         // Display "Done" screen and wait for moves to complete
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
         ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE));
76
         ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE));
77
       #endif
77
       #endif
78
       ui.goto_previous_screen_no_defer();
78
       ui.goto_previous_screen_no_defer();

Loading…
Cancel
Save