[FR?] Multiple endstops per stepper, select secondary endstop within "G28" Command

So I am not able to fully grasp how to do any hardcore coding for Klipper (slowly trying to learn) but from my understanding so far this seems like it could be possible? Anyone that has a knack for Klipper may be able to chime in for me on this.

Background:
Building a JennyCoreXY printer has proven to me at least that klipper is fairly configured only for the Voron2 when it comes to gantry leveling, and endstop positions. Due to a sagging gantry at the rear when powering down, I needed to get my gantry leveled before doing a QBL, and installed endstops at MAX, then proceed to PROBE Z0, and use a G92 with the Z_PROBE offset to have the printer find Z0.

Issue with this now is when I do QBL, it sees my endstops are not perfectly distanced from the print bed and fails the QBL due to out of tolerance. So unless I greatly widen my tolerance, it will never have that great of a result for QBL.

Proposal:
My proposal I believe can be implemented? And that’s where I am looking for insight from more experienced Klipper users / developers.

Is it possible to assign “default” enstops in the config, but then also secondary or even tertiary endstops that can be called upon within the “G28” command? In my situation a third would even be great to have an automatic Z_OFFSET.

Example Printer.cfg:

[stepper_z1]
step_pin: PB9
dir_pin: PE0
enable_pin: !PE1
microsteps: 32
rotation_distance: 8
endstop_pin1: PB1
endstop_pin2: probe:z_virtual_endstop
position1_max 400
position1_min -2
position2_max 0
position2_min -5

Example G28:

G28 X0 Y0 Z(P1)400 ; Home axis, Z max via endstop
G1 X200 Y200 Z50 ; Position tool head to center of the bed for probing
G28 Z(P2)0 ; Override Z homing position to max=0, via probe as Z-endstop

Does this seem logical? Or too much?

1 Like