瀏覽代碼

Merge pull request #5224 from thinkyhead/rc_limit_G30_xy

Fix G30 with limits, print correct probe XY
Scott Lahteine 8 年之前
父節點
當前提交
a0aad8d686
共有 1 個檔案被更改,包括 10 行新增9 行删除
  1. 10
    9
      Marlin/Marlin_main.cpp

+ 10
- 9
Marlin/Marlin_main.cpp 查看文件

@@ -4241,8 +4241,12 @@ inline void gcode_G28() {
4241 4241
    *     S = Stows the probe if 1 (default=1)
4242 4242
    */
4243 4243
   inline void gcode_G30() {
4244
-    float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
4245
-    float Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
4244
+    float X_probe_location = code_seen('X') ? code_value_axis_units(X_AXIS) : current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
4245
+          Y_probe_location = code_seen('Y') ? code_value_axis_units(Y_AXIS) : current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
4246
+
4247
+    float pos[XYZ] = { X_probe_location, Y_probe_location, LOGICAL_Z_POSITION(0) };
4248
+    if (!position_is_reachable(pos, true)) return;
4249
+
4246 4250
     bool stow = code_seen('S') ? code_value_bool() : true;
4247 4251
 
4248 4252
     // Disable leveling so the planner won't mess with us
@@ -4252,17 +4256,14 @@ inline void gcode_G28() {
4252 4256
 
4253 4257
     setup_for_endstop_or_probe_move();
4254 4258
 
4255
-    float measured_z = probe_pt(X_probe_location,
4256
-                                Y_probe_location,
4257
-                                stow, 1);
4259
+    float measured_z = probe_pt(X_probe_location, Y_probe_location, stow, 1);
4258 4260
 
4259 4261
     SERIAL_PROTOCOLPGM("Bed X: ");
4260
-    SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
4262
+    SERIAL_PROTOCOL(X_probe_location + 0.0001);
4261 4263
     SERIAL_PROTOCOLPGM(" Y: ");
4262
-    SERIAL_PROTOCOL(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
4264
+    SERIAL_PROTOCOL(Y_probe_location + 0.0001);
4263 4265
     SERIAL_PROTOCOLPGM(" Z: ");
4264
-    SERIAL_PROTOCOL(measured_z + 0.0001);
4265
-    SERIAL_EOL;
4266
+    SERIAL_PROTOCOLLN(measured_z + 0.0001);
4266 4267
 
4267 4268
     clean_up_after_endstop_or_probe_move();
4268 4269
 

Loading…
取消
儲存