-
-
Save rootiest/1f68250f9d72fea16ed325ece91c06b7 to your computer and use it in GitHub Desktop.
TEST RELEASE: Support beacon in GET_PROBE_LIMITS
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
# Macro to calculate the probe min/max/current coordinates | |
##########################DEPENDENCIES########################## | |
# | |
# This config section is required to output text to the console | |
# which is used by the macro. If you already have an equivalent | |
# config section elsewhere, you can comment this one out. | |
[respond] | |
# | |
################################################################ | |
[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}" | |
RESPOND MSG="Configured Probe Z-Offset {probe.z_offset}" | |
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