-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
GET_PROBE_LIMITS.cfg
55 lines (53 loc) · 2.49 KB
/
GET_PROBE_LIMITS.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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}"
{% 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 %}