Mesaure distance to Endstop
Is there a method to measure the distance from current tool position to endstop trigger point?
Let's say I position the tool (Extruder carriage) at some point on the X-axis (Manually, by hand), and I want to send a gcode command that moves the carriage to the X-axis endstop, and report the travel distance.
Is that possible?
if does, I would like to take it step forward, and use this script to measure the distance from coordinate to endstops between layer changes so to detect layer shifting.
It's possible to measure the distance to the endstop indirectly. If you do a normal G1 S1 homing move, then when the endstop is triggered the axis position will be set to the limit that you configured using M208. But if you use G1 S3 instead, then when the endstop is triggered the M208 limit will be set to the current axis position instead. So you could use a G1 S3 move at each layer change, then M208 without parameters to display the new M208 axis limits.