From 7f6434ba89a085b2e44c89f0dd74b3150bfbec95 Mon Sep 17 00:00:00 2001 From: Christopher Mattar Date: Thu, 26 Feb 2026 19:19:58 -0500 Subject: [PATCH 1/3] qgl: Expose Z heights in status reference Signed-off-by: Christopher Mattar --- docs/Status_Reference.md | 5 +++++ klippy/extras/quad_gantry_level.py | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/Status_Reference.md b/docs/Status_Reference.md index 1f6704acc..940b5dcd3 100644 --- a/docs/Status_Reference.md +++ b/docs/Status_Reference.md @@ -445,6 +445,11 @@ The following information is available in the `quad_gantry_level` object (this object is available if quad_gantry_level is defined): - `applied`: True if the gantry leveling process has been run and completed successfully. +- `z_height`: A list of four numbers indicating the Z actuator positions. + Set to `[0,0,0,0]` if the gantry leveling process has not been run. +- `z_positions`: A list of four numbers indicating the positions at which + the Z probe triggered during a quad gantry level. Set to `[0,0,0,0]` if + the gantry leveling process has not been run. ## query_endstops diff --git a/klippy/extras/quad_gantry_level.py b/klippy/extras/quad_gantry_level.py index 5556d5e1d..4641c8ab5 100644 --- a/klippy/extras/quad_gantry_level.py +++ b/klippy/extras/quad_gantry_level.py @@ -34,6 +34,8 @@ class QuadGantryLevel: raise config.error( "Need exactly 4 probe points for quad_gantry_level") self.z_status = z_tilt.ZAdjustStatus(self.printer) + self.z_height = [0,0,0,0] + self.z_positions = [0,0,0,0] self.z_helper = z_tilt.ZAdjustHelper(config, 4) self.gantry_corners = config.getlists('gantry_corners', parser=float, seps=(',', '\n'), count=2) @@ -89,6 +91,9 @@ class QuadGantryLevel: z_height[1] = self.plot(slope_y_s01, self.gantry_corners[1][1]) z_height[2] = self.plot(slope_y_s23, self.gantry_corners[1][1]) z_height[3] = self.plot(slope_y_s23, self.gantry_corners[0][1]) + + self.z_height = z_height + self.z_positions = z_positions ainfo = zip(["z","z1","z2","z3"], z_height[0:4]) apos = " ".join(["%s: %06f" % (x) for x in ainfo]) @@ -122,7 +127,11 @@ class QuadGantryLevel: def plot(self,f,x): return f[0]*x + f[1] def get_status(self, eventtime): - return self.z_status.get_status(eventtime) + return { + 'z_height': self.z_height, + 'z_positions': self.z_positions, + **self.z_status.get_status(eventtime) + } def load_config(config): return QuadGantryLevel(config) From d6a6607dcf69a6381e1adbf8c3837ab55462cb5d Mon Sep 17 00:00:00 2001 From: Christopher Mattar Date: Thu, 26 Feb 2026 20:10:14 -0500 Subject: [PATCH 2/3] fix: Remove trailing whitespace Signed-off-by: Christopher Mattar --- docs/Status_Reference.md | 6 +++--- klippy/extras/quad_gantry_level.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Status_Reference.md b/docs/Status_Reference.md index 940b5dcd3..59558febb 100644 --- a/docs/Status_Reference.md +++ b/docs/Status_Reference.md @@ -445,10 +445,10 @@ The following information is available in the `quad_gantry_level` object (this object is available if quad_gantry_level is defined): - `applied`: True if the gantry leveling process has been run and completed successfully. -- `z_height`: A list of four numbers indicating the Z actuator positions. +- `z_height`: A list of four numbers indicating the Z actuator positions. Set to `[0,0,0,0]` if the gantry leveling process has not been run. -- `z_positions`: A list of four numbers indicating the positions at which - the Z probe triggered during a quad gantry level. Set to `[0,0,0,0]` if +- `z_positions`: A list of four numbers indicating the positions at which + the Z probe triggered during a quad gantry level. Set to `[0,0,0,0]` if the gantry leveling process has not been run. ## query_endstops diff --git a/klippy/extras/quad_gantry_level.py b/klippy/extras/quad_gantry_level.py index 4641c8ab5..615bd5dbb 100644 --- a/klippy/extras/quad_gantry_level.py +++ b/klippy/extras/quad_gantry_level.py @@ -91,7 +91,7 @@ class QuadGantryLevel: z_height[1] = self.plot(slope_y_s01, self.gantry_corners[1][1]) z_height[2] = self.plot(slope_y_s23, self.gantry_corners[1][1]) z_height[3] = self.plot(slope_y_s23, self.gantry_corners[0][1]) - + self.z_height = z_height self.z_positions = z_positions From c2447bb15327104f1a73425f24a5f365fc24acdb Mon Sep 17 00:00:00 2001 From: Christopher Mattar Date: Fri, 27 Feb 2026 09:11:20 -0500 Subject: [PATCH 3/3] fix: Python2 syntax compatibility Signed-off-by: Christopher Mattar --- klippy/extras/quad_gantry_level.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/klippy/extras/quad_gantry_level.py b/klippy/extras/quad_gantry_level.py index 615bd5dbb..9942c0d6a 100644 --- a/klippy/extras/quad_gantry_level.py +++ b/klippy/extras/quad_gantry_level.py @@ -127,11 +127,12 @@ class QuadGantryLevel: def plot(self,f,x): return f[0]*x + f[1] def get_status(self, eventtime): - return { + status = { 'z_height': self.z_height, 'z_positions': self.z_positions, - **self.z_status.get_status(eventtime) } + status.update(self.z_status.get_status(eventtime)) + return status def load_config(config): return QuadGantryLevel(config)