pellcorp / creality

23 stars 4 forks source link

GET_PROBE_LIMITS #81

Open pellcorp opened 2 months ago

pellcorp commented 2 months ago

https://github.com/rootiest/zippy_guides/blob/main/resources/GET_PROBE_LIMITS.cfg

Also cleanup the [respond] config perhaps adding it to printer.cfg and remove from guppyscreen.cfg

pellcorp commented 1 month ago

From KILLbabylon:

[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 %}
    {% elif config["smart_effector"] %}
        # smart_effector probe section found
        {% set probe = config["smart_effector"] %}
        {% set has_probe = True %}
    {% elif config["probe_eddy_current btt_eddy"] %}
        # probe_eddy_current btt_eddy probe section found
        {% set probe = config["probe_eddy_current btt_eddy"] %}
        {% 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 %}

Can most likely add 'cartographer' as a clone of the beacon section, and for Simple AF would remove beacon and smart_effector, and until such time as btt eddy is supported remove that as well.