From 37bc0fce6244fcfaa1aa81bc5c644e109fe68f0f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 20 Jun 2017 00:09:59 -0500 Subject: [PATCH] Make G29 compatible with M206 Z and G92 Z Use the raw position for mesh measurement. Otherwise the `M206` and `M92` Z offsets will get canceled out by bed leveling. The downside is `G29` will not compensate for a poorly set small `M206` fudge value. To elaborate on this issue, imagine you are probing with a Z home offset of -0.1, meaning when Z homes, -0.1 is the current position, implying the ideal bed zero for the nozzle is 0.1mm higher than the Z endstop. Ordinarily when printing, Z would raise 0.1mm higher. What happens when we probe is that all points are measured with that -0.1 included. So when bed leveling is enabled the `M206 Z` offset gets exactly canceled out by the bed readings. --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7399e56dd..74426c00a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2278,7 +2278,7 @@ static void clean_up_after_endstop_or_probe_move() { SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - current_position[Z_AXIS]); } #endif - return current_position[Z_AXIS] + zprobe_zoffset; + return RAW_CURRENT_POSITION(Z) + zprobe_zoffset; } /**