Continuing the discussion from Understanding X and Y Axes Limits and Homing:
My reading of the documentation leads me to a different conclusion. After hitting the endstop when homing towards position_max
the origin is -position_endstop
away relative to the current position of the toolhead along the respective coordinate, and a similar fix for homing towards position_min
.
How I understand the process, before first homing, the printer assumes the toolhead is at origin in the printer coordinate system, the origin is always defined to be 0,0,0
and when the endstop is hit the toolhead position along the moved axis is forced to the value of position_endstop
, so the origin never really moves.
Example, along X we have position_min=-1
, position_max=121
, position_endstop=119
. The following (setup) sequence:
G28
G90
G0 X11 Y12 Z13
GET_POSITION
will report toolhead position 11,12,13
which is aligned with the printer coordinate system.
Then:
FIRMWARE_RESTART
GET_POSITION
The toolhead will not have moved physically, and klipper now (naively) thinks the toolhead is at 0,0,0
in the printer coordinate system.
G28
GET_POSITION
The toolhead will attempt to move in X for 121 and will stop after hitting the endstop while having traveled 108 = 119 - 11
and toolhead X position will be adjusted to 119
(assuming no homing_override
shenanigans).
G91
G1 X-109
GET_POSITION
The toolhead position in X will be 10
Also, does it make sense to clarify, that when talking about position of the toolhead we are talking about an abstract point in the center of the nozzle hole where filament exits the nozzle.