2025-03-31 09:32:57 +08:00

33 lines
1.2 KiB
INI

[gcode_button _door_detection]
pin: DOOR_PIN
press_gcode:
release_gcode:
{% set sv = printer.save_variables.variables %}
{% set door_function = sv.door_detect|default("Disabled") %}
{% if door_function != "Disabled" %}
M118 Printer door is opening!
{% endif %}
_DOOR_DETECTION_HANDLE STATUS='open'
[gcode_macro _DOOR_DETECTION_HANDLE]
gcode:
{% set sv = printer.save_variables.variables %}
{% set door_function = sv.door_detect|default("Disabled") %}
{% set status = params.STATUS|default("close") %}
{% set printing_state = printer.print_stats.state %}
{% if status=='open' and printing_state == 'printing' %}
{% if door_function == 'Emergency Stop' %}
M112
{% elif door_function == 'Pause Print' %}
PAUSE
{% endif %}
{% endif %}
[gcode_macro _DOOR_START_PRINT_BASE]
description: Call handle door is open when starting to print
gcode:
RESPOND TYPE=command MSG="action:prompt_begin"
RESPOND TYPE=command MSG="action:prompt_text Printer door is opened. Please close the door and then start printing."
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end"
RESPOND TYPE=command MSG="action:prompt_show"