Quellcode durchsuchen

Merge pull request #5163 from nzinov/RCBugFix

Improve G30 probing command - add optional arguments
Scott Lahteine vor 8 Jahren
Ursprung
Commit
dcfd7c69e8
1 geänderte Dateien mit 12 neuen und 4 gelöschten Zeilen
  1. 12
    4
      Marlin/Marlin_main.cpp

+ 12
- 4
Marlin/Marlin_main.cpp Datei anzeigen

@@ -117,7 +117,7 @@
117 117
  * G21 - Set input units to millimeters
118 118
  * G28 - Home one or more axes
119 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 121
  * G31 - Dock sled (Z_PROBE_SLED only)
122 122
  * G32 - Undock sled (Z_PROBE_SLED only)
123 123
  * G38 - Probe target - similar to G28 except it uses the Z_MIN endstop for all three axes
@@ -4226,8 +4226,16 @@ inline void gcode_G28() {
4226 4226
 
4227 4227
   /**
4228 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 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 4240
     // Disable leveling so the planner won't mess with us
4233 4241
     #if PLANNER_LEVELING
@@ -4236,9 +4244,9 @@ inline void gcode_G28() {
4236 4244
 
4237 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 4251
     SERIAL_PROTOCOLPGM("Bed X: ");
4244 4252
     SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);

Laden…
Abbrechen
Speichern