Z_TILT and position_endstop not compatible? Z=0 always wrong

Hi there,

i have a strange klipper behaviour. I cannot use

[z_tilt]
z_positions:  -60, 117.5
             340, 117.5
points:        70, 117.5
             280, 117.5
speed: 300
horizontal_move_z: 3
retries: 10
retry_tolerance: 0.005

and

#*# [stepper_z]
#*# position_endstop = -0.090

together. Z=0 is always wrong when using Z_TILT_ADJUST
Babystepping/Z-Offset is adjusted via shifting the “Z-Endstop”:


which results in:

#*# [stepper_z]
#*# position_endstop = -0.090

MBL:

[probe]
pin: ^PC2
x_offset: -35
y_offset: 0
speed: 1
samples: 1
lift_speed: 12

[bed_mesh]
speed: 300
horizontal_move_z: 3
mesh_min: 35,10
mesh_max: 245,220
probe_count: 3,3
fade_start: 1
fade_end: 0
relative_reference_index: 4

Z Stepper:

[stepper_z]
step_pin: PA15
dir_pin: PA8
enable_pin: !PD1
microsteps: 32
rotation_distance: 4
full_steps_per_rotation: 200
endstop_pin: ^!PC0
position_min = -4
position_max: 300
homing_speed: 4
homing_retract_speed: 2
homing_retract_dist: 3
second_homing_speed: 0.5

[stepper_z1]
step_pin: PD11
dir_pin: PD10
enable_pin: !PD13
microsteps: 32
rotation_distance: 4
full_steps_per_rotation: 200
endstop_pin: ^!PA0

Hardware:
CoreXY with 2 Z motors and 2 Z endstops and 1 induktive probe for mesh bed leveling

How to reproduce the problem:
Set the

#*# [stepper_z]
#*# position_endstop = -0.090

to some high value, so that the nozzle will be some mm over the bed for z=0, lets say position_endstop = -3.0

Now home all axis and do a mesh bed leveling. after that go to some point of the bed. i.e center and type G0 Z0
The nozzle is about 3mm over the bed, which is correct, i have a z position endstop of -3 defined.

Now home all axis, do a Z_TILT_ADJUST and then mesh bed leveling. after that go again to some point of the bed. i.e center and type G0 Z0. Now the nozzle is attached to the bed.

It seems the the “offset” from position_endstop is ignored or not used for final z calculation. Does s.o. else encountered the same problem?

I’m not entirely sure I understand what you are reporting. However, this sounds like it is the intended behaviour of the Z_TILT_ADJUST command.

The Z_TILT_ADJUST command will both level the Z steppers and attempt to match the Z offset according to the probe z offset. (In this regard, the Z_TILT_ADJUST command is different from the similar, but for different hardware, QUAD_GANTRY_LEVEL command.)

If you don’t want Z_TILT_ADJUST to adjust the kinematic Z offset, then it should be possible to run a G28 Z0 command immediately after a Z_TILT_ADJUST command.

Cheers,
-Kevin

Can you post the results of the Z_TILT_ADJUST run?

Ok i try to explain it:
I corrected my real physical z offset via babystepping and saved it to the software/z-endstop

which results in the following printer.cfg entry:

#*# [stepper_z]
#*# position_endstop = -0.090

So the real Z=0 is always corrected by klipper with -0.090 because of the saved babystepping z-offset:

#*# [stepper_z]
#*# position_endstop = -0.090

Lets say Z_TILT_ADJUST gets the following results after measurement:
Adjust left (z0 stepper): 0.005
Adjust right (z1 stepper): -0.005

So the final z-offset which klipper should respect is:
left side: -0.085 → -0.090 + 0.005 = -0.085
right side: -0.095 → -0.090 - 0.005 = -0.095

Instead the final z-offset which klipper now corrects via software is:
left side: 0.005
right side: -0.005

the results of the Z_TILT_ADJUST measurement is not applied/summed up to my saved, shifted z-offset which was adjusted via babystepping and saved in

#*# [stepper_z]
#*# position_endstop = -0.090

I hope u understand what i try to say - In other words: My saved babystepping z-offset is always ignored and not used after Z_TILT_ADJUST

Result of Z_TILT_ADJUST:

Retries: 2/10 Probed points range: 0.006250 tolerance: 0.010000

19:38:48

Making the following Z adjustments:
stepper_z = -0.004487
stepper_z1 = 0.007394

19:38:48

probe at 280.000,117.501 is z=1.244574

19:38:45

probe at 70.001,117.499 is z=1.238324

19:38:41

Retries: 1/10 Probed points range: 0.016875 tolerance: 0.010000

19:38:41

Making the following Z adjustments:
stepper_z = 0.016598
stepper_z1 = -0.015511

19:38:41

probe at 280.000,117.501 is z=1.232110

19:38:38

probe at 70.001,117.499 is z=1.248985

19:38:35

Retries: 0/10 Probed points range: 0.036406 tolerance: 0.010000

19:38:35

Making the following Z adjustments:
stepper_z = -0.406485
stepper_z1 = -0.337117

19:38:35

probe at 280.000,117.501 is z=0.886406

19:38:32

probe at 70.001,117.499 is z=0.850000

19:38:28

Z_TILT_ADJUST

19:38:13

G28

Unfortunately, I don’t use Z_TILT_ADJUST (none of my printers have that hardware) and don’t use graphical interfaces to adjust Z offsets, so there isn’t much advice that I can offer.

I can say that using Z_TILT_ADJUST will cause the kinematic Z to use the probe z_offset (not the endstop z_offset) until the next G28 Z0 command (at which time, the endstop z_offset will be used). This behaviour can be confusing, but it is the intended behaviour.

Cheers,
-Kevin

Can you give me some hint where i have to replace the probe_offset with the z_endstop_offset in the
klippy/extras/z_tilt.py. if i unterstand you correct, i just need to replace the probe_offset with z_offset in the /klippy/extras/z_tilt.py to get it working for my needs