Browse Source

Return Z position in run_z_probe

Scott Lahteine 9 years ago
parent
commit
3763d45656
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      Marlin/Marlin_main.cpp

+ 6
- 5
Marlin/Marlin_main.cpp View File

@@ -1993,7 +1993,7 @@ static void clean_up_after_endstop_or_probe_move() {
1993 1993
 
1994 1994
   // Do a single Z probe and return with current_position[Z_AXIS]
1995 1995
   // at the height where the probe triggered.
1996
-  static void run_z_probe() {
1996
+  static float run_z_probe() {
1997 1997
 
1998 1998
     float old_feedrate = feedrate;
1999 1999
 
@@ -2076,6 +2076,8 @@ static void clean_up_after_endstop_or_probe_move() {
2076 2076
     #endif // !DELTA
2077 2077
 
2078 2078
     feedrate = old_feedrate;
2079
+
2080
+    return current_position[Z_AXIS];
2079 2081
   }
2080 2082
 
2081 2083
 #endif // HAS_BED_PROBE
@@ -2134,8 +2136,7 @@ static void clean_up_after_endstop_or_probe_move() {
2134 2136
       deploy_z_probe();
2135 2137
     }
2136 2138
 
2137
-    run_z_probe();
2138
-    float measured_z = current_position[Z_AXIS];
2139
+    float measured_z = run_z_probe();
2139 2140
 
2140 2141
     if (probe_action & ProbeStow) {
2141 2142
       #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -3851,14 +3852,14 @@ inline void gcode_G28() {
3851 3852
     stepper.synchronize();
3852 3853
 
3853 3854
     // TODO: clear the leveling matrix or the planner will be set incorrectly
3854
-    run_z_probe(); // clears the ABL non-delta matrix only
3855
+    float measured_z = run_z_probe(); // clears the ABL non-delta matrix only
3855 3856
 
3856 3857
     SERIAL_PROTOCOLPGM("Bed X: ");
3857 3858
     SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
3858 3859
     SERIAL_PROTOCOLPGM(" Y: ");
3859 3860
     SERIAL_PROTOCOL(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
3860 3861
     SERIAL_PROTOCOLPGM(" Z: ");
3861
-    SERIAL_PROTOCOL(current_position[Z_AXIS] + 0.0001);
3862
+    SERIAL_PROTOCOL(measured_z + 0.0001);
3862 3863
     SERIAL_EOL;
3863 3864
 
3864 3865
     stow_z_probe();

Loading…
Cancel
Save