Browse Source

Merge pull request #5163 from nzinov/RCBugFix

Improve G30 probing command - add optional arguments
Scott Lahteine 8 years ago
parent
commit
dcfd7c69e8
1 changed files with 12 additions and 4 deletions
  1. 12
    4
      Marlin/Marlin_main.cpp

+ 12
- 4
Marlin/Marlin_main.cpp View File

117
  * G21 - Set input units to millimeters
117
  * G21 - Set input units to millimeters
118
  * G28 - Home one or more axes
118
  * G28 - Home one or more axes
119
  * G29 - Detailed Z probe, probes the bed at 3 or more points.  Will fail if you haven't homed yet.
119
  * G29 - Detailed Z probe, probes the bed at 3 or more points.  Will fail if you haven't homed yet.
120
- * G30 - Single Z probe, probes bed at current XY location.
120
+ * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
121
  * G31 - Dock sled (Z_PROBE_SLED only)
121
  * G31 - Dock sled (Z_PROBE_SLED only)
122
  * G32 - Undock sled (Z_PROBE_SLED only)
122
  * G32 - Undock sled (Z_PROBE_SLED only)
123
  * G38 - Probe target - similar to G28 except it uses the Z_MIN endstop for all three axes
123
  * G38 - Probe target - similar to G28 except it uses the Z_MIN endstop for all three axes
4226
 
4226
 
4227
   /**
4227
   /**
4228
    * G30: Do a single Z probe at the current XY
4228
    * G30: Do a single Z probe at the current XY
4229
+   * Usage:
4230
+   *   G30 <X#> <Y#> <S#>
4231
+   *     X = Probe X position (default=current probe position)
4232
+   *     Y = Probe Y position (default=current probe position)
4233
+   *     S = Stows the probe if 1 (default=1)
4229
    */
4234
    */
4230
   inline void gcode_G30() {
4235
   inline void gcode_G30() {
4236
+    float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
4237
+    float Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
4238
+    bool stow = code_seen('S') ? code_value_bool() : true;
4231
 
4239
 
4232
     // Disable leveling so the planner won't mess with us
4240
     // Disable leveling so the planner won't mess with us
4233
     #if PLANNER_LEVELING
4241
     #if PLANNER_LEVELING
4236
 
4244
 
4237
     setup_for_endstop_or_probe_move();
4245
     setup_for_endstop_or_probe_move();
4238
 
4246
 
4239
-    float measured_z = probe_pt(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
4240
-                                current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
4241
-                                true, 1);
4247
+    float measured_z = probe_pt(X_probe_location,
4248
+                                Y_probe_location,
4249
+                                stow, 1);
4242
 
4250
 
4243
     SERIAL_PROTOCOLPGM("Bed X: ");
4251
     SERIAL_PROTOCOLPGM("Bed X: ");
4244
     SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
4252
     SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);

Loading…
Cancel
Save