Return Z position in run_z_probe

This commit is contained in:
Scott Lahteine 2016-06-22 16:52:32 -07:00
parent 1f48b5c30f
commit 3763d45656

View File

@ -1993,7 +1993,7 @@ static void clean_up_after_endstop_or_probe_move() {
// Do a single Z probe and return with current_position[Z_AXIS] // Do a single Z probe and return with current_position[Z_AXIS]
// at the height where the probe triggered. // at the height where the probe triggered.
static void run_z_probe() { static float run_z_probe() {
float old_feedrate = feedrate; float old_feedrate = feedrate;
@ -2076,6 +2076,8 @@ static void clean_up_after_endstop_or_probe_move() {
#endif // !DELTA #endif // !DELTA
feedrate = old_feedrate; feedrate = old_feedrate;
return current_position[Z_AXIS];
} }
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE
@ -2134,8 +2136,7 @@ static void clean_up_after_endstop_or_probe_move() {
deploy_z_probe(); deploy_z_probe();
} }
run_z_probe(); float measured_z = run_z_probe();
float measured_z = current_position[Z_AXIS];
if (probe_action & ProbeStow) { if (probe_action & ProbeStow) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
@ -3851,14 +3852,14 @@ inline void gcode_G28() {
stepper.synchronize(); stepper.synchronize();
// TODO: clear the leveling matrix or the planner will be set incorrectly // TODO: clear the leveling matrix or the planner will be set incorrectly
run_z_probe(); // clears the ABL non-delta matrix only float measured_z = run_z_probe(); // clears the ABL non-delta matrix only
SERIAL_PROTOCOLPGM("Bed X: "); SERIAL_PROTOCOLPGM("Bed X: ");
SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001); SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
SERIAL_PROTOCOLPGM(" Y: "); SERIAL_PROTOCOLPGM(" Y: ");
SERIAL_PROTOCOL(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER + 0.0001); SERIAL_PROTOCOL(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
SERIAL_PROTOCOLPGM(" Z: "); SERIAL_PROTOCOLPGM(" Z: ");
SERIAL_PROTOCOL(current_position[Z_AXIS] + 0.0001); SERIAL_PROTOCOL(measured_z + 0.0001);
SERIAL_EOL; SERIAL_EOL;
stow_z_probe(); stow_z_probe();