-
-
Save rootiest/79443bc72f3a161fb6cb86ee2eae7b47 to your computer and use it in GitHub Desktop.
Test Release - Support Trigger Distance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[gcode_macro GET_PROBE_LIMITS] | |
description: Calculates the probe min/max/current coordinates | |
gcode: | |
{% set config = printer.configfile.settings %} | |
# Find probe config in configfile | |
{% if config["bltouch"] %} | |
# bltouch section found | |
{% set probe = config["bltouch"] %} | |
{% set has_probe = True %} | |
{% elif config["probe"] %} | |
# probe section found | |
{% set probe = config["probe"] %} | |
{% set has_probe = True %} | |
{% elif config["beacon"] %} | |
# probe section found | |
{% set probe = config["beacon"] %} | |
{% set has_probe = True %} | |
{% else %} | |
# No probe or bltouch sections found | |
RESPOND MSG="Failed to detect probe in configfile" | |
{% endif %} | |
{% if has_probe %} | |
{% set stepperx = config["stepper_x"] %} | |
{% set steppery = config["stepper_y"] %} | |
{% set xprobemin = stepperx["position_min"]|float + probe["x_offset"]|float %} | |
{% set xprobemax = stepperx["position_max"]|float + probe["x_offset"]|float %} | |
{% set yprobemin = steppery["position_min"]|float + probe["y_offset"]|float %} | |
{% set yprobemax = steppery["position_max"]|float + probe["y_offset"]|float %} | |
RESPOND MSG="Configured Probe X-Offset {probe.x_offset}" | |
RESPOND MSG="Configured Probe Y-Offset {probe.y_offset}" | |
{% if probe.z_offset is defined %} | |
RESPOND MSG="Configured Probe Z-Offset {probe.z_offset}" | |
{% elif probe.trigger_distance is defined %} | |
RESPOND MSG="Configured Probe Trigger Distance {probe.trigger_distance}" | |
{% endif %} | |
RESPOND MSG="Minimum PROBE position X={xprobemin} Y={yprobemin}" | |
RESPOND MSG="Maximum PROBE position X={xprobemax} Y={yprobemax}" | |
# check if printer homed | |
{% if "xyz" in printer.toolhead.homed_axes %} | |
{% set curprobex = printer.toolhead.position.x|float + probe["x_offset"]|float %} | |
{% set curprobey = printer.toolhead.position.y|float + probe["y_offset"]|float %} | |
RESPOND MSG="Current PROBE position X={curprobex} Y={curprobey}" | |
{% endif %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment