Browse Source

'G29 H' to set a centered square probe area (linear, bilinear) (#12242)

MasterPIC 6 years ago
parent
commit
6fbc87301f
2 changed files with 18 additions and 5 deletions
  1. 17
    4
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  2. 1
    1
      Marlin/src/module/probe.cpp

+ 17
- 4
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

103
  *
103
  *
104
  *  S  Set the XY travel speed between probe points (in units/min)
104
  *  S  Set the XY travel speed between probe points (in units/min)
105
  *
105
  *
106
+ *  H  Set bounds to a centered square H x H units in size
107
+ *
108
+ *     -or-
109
+ *
106
  *  F  Set the Front limit of the probing grid
110
  *  F  Set the Front limit of the probing grid
107
  *  B  Set the Back limit of the probing grid
111
  *  B  Set the Back limit of the probing grid
108
  *  L  Set the Left limit of the probing grid
112
  *  L  Set the Left limit of the probing grid
381
 
385
 
382
       xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED));
386
       xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED));
383
 
387
 
384
-      left_probe_bed_position  = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION;
385
-      right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : RIGHT_PROBE_BED_POSITION;
386
-      front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : FRONT_PROBE_BED_POSITION;
387
-      back_probe_bed_position  = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : BACK_PROBE_BED_POSITION;
388
+      if (parser.seen('H')) {
389
+        const int16_t size = (int16_t)parser.value_linear_units();
390
+        left_probe_bed_position  = MAX((MIN_PROBE_X + MAX_PROBE_X - size) / 2, MIN_PROBE_X);
391
+        right_probe_bed_position = MIN(left_probe_bed_position + size,         MAX_PROBE_X);
392
+        front_probe_bed_position = MAX((MIN_PROBE_Y + MAX_PROBE_Y - size) / 2, MIN_PROBE_Y);
393
+        back_probe_bed_position  = MIN(front_probe_bed_position + size,        MAX_PROBE_Y);
394
+      }
395
+      else {
396
+        left_probe_bed_position  = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION;
397
+        right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : RIGHT_PROBE_BED_POSITION;
398
+        front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : FRONT_PROBE_BED_POSITION;
399
+        back_probe_bed_position  = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : BACK_PROBE_BED_POSITION;
400
+      }
388
 
401
 
389
       if (
402
       if (
390
         #if IS_SCARA || ENABLED(DELTA)
403
         #if IS_SCARA || ENABLED(DELTA)

+ 1
- 1
Marlin/src/module/probe.cpp View File

401
     deploy ? run_deploy_moves_script() : run_stow_moves_script();
401
     deploy ? run_deploy_moves_script() : run_stow_moves_script();
402
 
402
 
403
   #elif ENABLED(RACK_AND_PINION_PROBE)
403
   #elif ENABLED(RACK_AND_PINION_PROBE)
404
-    
404
+
405
     do_blocking_move_to_x(deploy ? Z_PROBE_DEPLOY_X : Z_PROBE_RETRACT_X);
405
     do_blocking_move_to_x(deploy ? Z_PROBE_DEPLOY_X : Z_PROBE_RETRACT_X);
406
 
406
 
407
   #endif
407
   #endif

Loading…
Cancel
Save