Skip to content

qgl: Expose Z heights in status reference#7211

Open
3DCoded wants to merge 3 commits intoKlipper3d:masterfrom
3DCoded:qgl-status
Open

qgl: Expose Z heights in status reference#7211
3DCoded wants to merge 3 commits intoKlipper3d:masterfrom
3DCoded:qgl-status

Conversation

@3DCoded
Copy link

@3DCoded 3DCoded commented Feb 27, 2026

This PR exposes the Z actuator positions of quad_gantry_level in the status reference for use in G-code macros.

Signed-off-by: Christopher Mattar <info@3dcoded.xyz>
Signed-off-by: Christopher Mattar <info@3dcoded.xyz>
Signed-off-by: Christopher Mattar <info@3dcoded.xyz>
@MRX8024
Copy link
Contributor

MRX8024 commented Feb 27, 2026

Can you give examples of how this is used in macros, i.e. what do you do with this parameters?

@3DCoded
Copy link
Author

3DCoded commented Feb 27, 2026

Can you give examples of how this is used in macros, i.e. what do you do with this parameters?

Sure. On my setup (Cartographer probe), I do one coarse QGL within 1mm of tolerance with a 10mm probe height then another fine QGL within 0.025mm with a 2mm probe height to speed things up. With this, the second fine QGL could be skipped if the gantry was already within tolerance (e.g. after a Klippy restart).

Example:

[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing: BASE_QGL
gcode:
  {% set z_pos = printer.quad_gantry_level.z_positions %}
  {% set z_max = z_pos|max %}
  {% set z_min = z_pos|min %}
  {% set z_range = z_max - z_min %}
  {% if z_range == 0 or z_range > 1 %} ; no QGL yet or over 1mm, do coarse then fine QGL
    BASE_QGL HORIZONTAL_MOVE_Z=10 RETRY_TOLERANCE=1
    FINE_QGL
  {% elif z_range > 0.025 %} ; QGL range between 0.025mm and 1mm, do fine QGL
    FINE_QGL
  {% endif %} ; if neither statement is run, range 0.025mm or less, save a QGL cycle

[gcode_macro FINE_QGL]
gcode:
  {% set z_pos = printer.quad_gantry_level.z_positions %}
  {% set z_max = z_pos|max %}
  {% set z_min = z_pos|min %}
  {% set z_range = z_max - z_min %}
  {% if z_range > 0.025 %}
    BASE_QGL HORIZONTAL_MOVE_Z=2 RETRY_TOLERANCE=0.025
  {% endif %}

@nefelim4ag
Copy link
Collaborator

nefelim4ag commented Mar 11, 2026

I think in this context it can make sense to "remove" the 4mm calibration limit from the probe_eddy_current calibration curve. It can be done either by making calibration in a streaming fashion or by making it configurable. I would prefer to avoid the addition of a new option.

Otherwise, it seems weird to make changes to benefit the external code. Or, I probably misunderstood something.

I think about it again, in the above example, on the vanilla code, it does not make sense, because probe will descend until trigger, there is no need to second QGL after the first QGL.
The only example where it can make sense is if one uses METHOD=scan, but you can't use "scan" with a height over 4 mm.

-Timofey

@MRX8024
Copy link
Contributor

MRX8024 commented Mar 11, 2026

This will benefit regular probes as there will be no need to make large z_hops between measurement points if they are not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants