# Z\_TILT and position\_endstop not compatible? Z=0 always wrong

**URL:** <https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976>\
**Category:** General Discussion\
**Created:** [May 24, 2022, 10:18am UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976 "2022-05-24T10:18:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hundsbuah](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hundsbuah](https://klipper.discourse.group/u/Hundsbuah)\
**Post date:** [May 24, 2022, 10:18am UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/1 "2022-05-24T10:18:50Z")

</div>

Hi there,

i have a strange klipper behaviour. I cannot use

```auto
[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

```auto
#*# [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”:

 ![2022-05-24 12_26_23-22% Printing - ETA_ 13_19 - CFFFP_3DBenchy.gcode](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/4/42fa0f43584b7629c2cc3b0582b7606e3f4472f1.png)  
which results in:

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

```

**MBL:**

```auto
[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:**

```auto
[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

```auto
#*# [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?

---

<div class="post-metadata">

**Author:** ![koconnor](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@koconnor](https://klipper.discourse.group/u/koconnor)\
**Post date:** [June 1, 2022, 4:04pm UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/2 "2022-06-01T16:04:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [June 1, 2022, 5:33pm UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/3 "2022-06-01T17:33:27Z")

</div>

Can you post the results of the Z\_TILT\_ADJUST run?

---

<div class="post-metadata">

**Author:** ![Hundsbuah](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hundsbuah](https://klipper.discourse.group/u/Hundsbuah)\
**Post date:** [June 1, 2022, 5:50pm UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/4 "2022-06-01T17:50:58Z")

</div>

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

 ![2022-05-24 12_26_23-22% Printing - ETA_ 13_19 - CFFFP_3DBenchy.gcode](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/4/42fa0f43584b7629c2cc3b0582b7606e3f4472f1.png)

which results in the following printer.cfg entry:

```auto
#*# [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:

```auto
#*# [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

```auto
#*# [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:**

```auto
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

```

---

<div class="post-metadata">

**Author:** ![koconnor](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@koconnor](https://klipper.discourse.group/u/koconnor)\
**Post date:** [June 1, 2022, 5:58pm UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/5 "2022-06-01T17:58:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hundsbuah](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hundsbuah](https://klipper.discourse.group/u/Hundsbuah)\
**Post date:** [June 1, 2022, 6:04pm UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/6 "2022-06-01T18:04:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [May 10, 2024, 9:06pm UTC](https://klipper.discourse.group/t/z-tilt-and-position-endstop-not-compatible-z-0-always-wrong/2976/7 "2024-05-10T21:06:42Z")

</div>


