# Quad\_gantry\_level: max\_adjust only guards the positive direction

**URL:** <https://klipper.discourse.group/t/quad-gantry-level-max-adjust-only-guards-the-positive-direction/26249>\
**Category:** General Discussion\
**Created:** [August 18, 2026, 3:39pm UTC](https://klipper.discourse.group/t/quad-gantry-level-max-adjust-only-guards-the-positive-direction/26249 "2026-08-18T15:39:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredh](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/fredh/32/20407_2.png) [@fredh](https://klipper.discourse.group/u/fredh)\
**Post date:** [August 18, 2026, 3:39pm UTC](https://klipper.discourse.group/t/quad-gantry-level-max-adjust-only-guards-the-positive-direction/26249/1 "2026-08-18T15:39:18Z")

</div>

### Basic Information:

Printer Model: Voron 2.4  
 MCU / Printerboard: Octopus  
 Host / SBC Raspi 4  
 klippy.log: Not applicable - this is a code-reading finding, not an observed failure

_Fill out above information and_ _ **in all cases attach your** _ **`klippy.log` _file_** (use zip to compress it, if too big). _Pasting your_ `printer.cfg` _is **not** needed_  
_ **Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there** _

### Describe your issue:

### quad\_gantry\_level: max\_adjust only guards the positive direction

**File:** klippy/extras/quad\_gantry\_level.py, in probe\_finalize()

**Code:**

```auto
z_ave = sum(z_height) / len(z_height)
z_adjust = []
for z in z_height:
    z_adjust.append(z_ave - z)

adjust_max = max(z_adjust)
if adjust_max > self.max_adjust:
    raise self.gcode.error("Aborting quad_gantry_level ...")

```

**Problem:**

z\_adjust is computed as (z\_ave - z\_height) for each stepper, where z\_ave is  
the mean of z\_height. The four values therefore always sum to exactly zero.

The guard tests only max(z\_adjust), so it constrains the largest POSITIVE  
adjustment and never examines the largest negative one.

Because the values sum to zero, for N=4 the most negative element is bounded  
by -3 \* max(z\_adjust). The guard therefore permits a negative adjustment of  
up to 3 \* max\_adjust.

**Example** (max\_adjust = 10):

```auto
z_adjust = [-30.0, +10.0, +10.0, +10.0]
max(z_adjust) = 10.0 -> not > 10.0 -> passes
one gantry corner is then driven down 30 mm

```

**Impact:**

max\_adjust is a safety limit intended to stop a bad probe result driving the  
gantry into the bed. In the negative direction it under-protects by 3x. It  
only bites when probing returns a wildly wrong value, which is exactly the  
condition the guard exists for.

**Suggested fix:**

```auto
adjust_max = max(abs(z) for z in z_adjust)

```

or test max() and min() separately so the error message can report which  
stepper and which direction.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)\
**Post date:** [October 17, 2026, 3:40pm UTC](https://klipper.discourse.group/t/quad-gantry-level-max-adjust-only-guards-the-positive-direction/26249/2 "2026-10-17T15:40:18Z")

</div>

Closed on October 17, 2026, 3:40pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
