Browse Source

Fix G30 with limits, print correct probe XY

Scott Lahteine 8 years ago
parent
commit
410657b050
1 changed files with 10 additions and 9 deletions
  1. 10
    9
      Marlin/Marlin_main.cpp

+ 10
- 9
Marlin/Marlin_main.cpp View File

4241
    *     S = Stows the probe if 1 (default=1)
4241
    *     S = Stows the probe if 1 (default=1)
4242
    */
4242
    */
4243
   inline void gcode_G30() {
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
     bool stow = code_seen('S') ? code_value_bool() : true;
4250
     bool stow = code_seen('S') ? code_value_bool() : true;
4247
 
4251
 
4248
     // Disable leveling so the planner won't mess with us
4252
     // Disable leveling so the planner won't mess with us
4252
 
4256
 
4253
     setup_for_endstop_or_probe_move();
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
     SERIAL_PROTOCOLPGM("Bed X: ");
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
     SERIAL_PROTOCOLPGM(" Y: ");
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
     SERIAL_PROTOCOLPGM(" Z: ");
4265
     SERIAL_PROTOCOLPGM(" Z: ");
4264
-    SERIAL_PROTOCOL(measured_z + 0.0001);
4265
-    SERIAL_EOL;
4266
+    SERIAL_PROTOCOLLN(measured_z + 0.0001);
4266
 
4267
 
4267
     clean_up_after_endstop_or_probe_move();
4268
     clean_up_after_endstop_or_probe_move();
4268
 
4269
 

Loading…
Cancel
Save