实现开门检测功能
This commit is contained in:
parent
3839849aa0
commit
82b7fc8acf
32
config/CreatBot_D1000/1.1/door_detect.cfg
Normal file
32
config/CreatBot_D1000/1.1/door_detect.cfg
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[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"
|
@ -10,6 +10,10 @@ filename: ~/printer_data/config/config_variables.cfg
|
|||||||
|
|
||||||
[exclude_object]
|
[exclude_object]
|
||||||
|
|
||||||
|
[board_pins]
|
||||||
|
aliases:
|
||||||
|
DOOR_PIN=PC5
|
||||||
|
|
||||||
[gcode_arcs]
|
[gcode_arcs]
|
||||||
resolution: 1.0
|
resolution: 1.0
|
||||||
|
|
||||||
@ -803,24 +807,41 @@ gcode:
|
|||||||
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
{% set do_resume = False %}
|
{% set do_resume = False %}
|
||||||
{% set runout = True %}
|
{% set runout = True %}
|
||||||
##### end of definitions #####
|
{% macro resume_action() %}
|
||||||
_FILAMENT_UPDATE
|
_FILAMENT_UPDATE
|
||||||
_RESUME_EXTRUDER AUTOSHIFT={autoshift}
|
_RESUME_EXTRUDER AUTOSHIFT={autoshift}
|
||||||
_EXTRUDER_TEMPERATURE_HANDLE
|
_EXTRUDER_TEMPERATURE_HANDLE
|
||||||
|
|
||||||
{% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config
|
{% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config
|
||||||
else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder
|
else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder
|
||||||
#### Printer comming from timeout idle state ####
|
#### Printer comming from timeout idle state ####
|
||||||
{% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %}
|
{% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %}
|
||||||
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=Fals
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
|
||||||
|
{% endif %}
|
||||||
|
{% if last_extruder_temp.restore or last_extruder1_temp.restore %}
|
||||||
|
{ client.user_temp_macro|default("") }
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% elif can_extrude %}
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% endif %}
|
||||||
|
_ACT_RESUME DO_RESUME={ do_resume }
|
||||||
|
{% endmacro %}
|
||||||
|
{% if printer['gcode_button _door_detection'] %}
|
||||||
|
{% set sv = printer.save_variables.variables %}
|
||||||
|
{% set door_function = sv.door_detect|default("Disabled") %}
|
||||||
|
{% set door_state = printer['gcode_button _door_detection'].state|default('released')|lower %}
|
||||||
|
|
||||||
|
{% if door_function == 'Pause Print' and door_state == 'pressed' %}
|
||||||
|
{ resume_action() }
|
||||||
|
{% elif door_function == 'Pause Print' and door_state == 'released' %}
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_begin"
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_text Please close the door and click Resume to proceed."
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end"
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_show"
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{ resume_action() }
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if last_extruder_temp.restore or last_extruder1_temp.restore %}
|
|
||||||
{client.user_temp_macro|default("")}
|
|
||||||
{% set do_resume = True %}
|
|
||||||
{% elif can_extrude %}
|
|
||||||
{% set do_resume = True %}
|
|
||||||
{% endif %}
|
|
||||||
_ACT_RESUME DO_RESUME={do_resume}
|
|
||||||
|
|
||||||
[gcode_macro _ACT_RESUME]
|
[gcode_macro _ACT_RESUME]
|
||||||
gcode:
|
gcode:
|
||||||
@ -1155,3 +1176,5 @@ gcode:
|
|||||||
gcode:
|
gcode:
|
||||||
RUN_SHELL_COMMAND CMD=fetch_assets PARAMS="\"Gcode\" \"D1000HS\" \"NozzleAglin.zip\""
|
RUN_SHELL_COMMAND CMD=fetch_assets PARAMS="\"Gcode\" \"D1000HS\" \"NozzleAglin.zip\""
|
||||||
SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode"
|
SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode"
|
||||||
|
|
||||||
|
[include module/*.cfg]
|
||||||
|
32
config/CreatBot_D600Pro2/1.1/door_detect.cfg
Normal file
32
config/CreatBot_D600Pro2/1.1/door_detect.cfg
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[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"
|
@ -10,6 +10,10 @@ filename: ~/printer_data/config/config_variables.cfg
|
|||||||
|
|
||||||
[exclude_object]
|
[exclude_object]
|
||||||
|
|
||||||
|
[board_pins]
|
||||||
|
aliases:
|
||||||
|
DOOR_PIN=PC5
|
||||||
|
|
||||||
[gcode_arcs]
|
[gcode_arcs]
|
||||||
resolution: 1.0
|
resolution: 1.0
|
||||||
|
|
||||||
@ -794,25 +798,42 @@ gcode:
|
|||||||
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
|
||||||
{% set do_resume = False %}
|
{% set do_resume = False %}
|
||||||
{% set runout = True %}
|
{% set runout = True %}
|
||||||
##### end of definitions #####
|
{% macro resume_action() %}
|
||||||
_FILAMENT_UPDATE
|
_FILAMENT_UPDATE
|
||||||
_RESUME_EXTRUDER AUTOSHIFT={autoshift}
|
_RESUME_EXTRUDER AUTOSHIFT={autoshift}
|
||||||
_EXTRUDER_TEMPERATURE_HANDLE
|
_EXTRUDER_TEMPERATURE_HANDLE
|
||||||
|
|
||||||
{% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config
|
{% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config
|
||||||
else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder
|
else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder
|
||||||
|
|
||||||
#### Printer comming from timeout idle state ####
|
#### Printer comming from timeout idle state ####
|
||||||
{% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %}
|
{% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %}
|
||||||
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=Fals
|
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
|
||||||
|
{% endif %}
|
||||||
|
{% if last_extruder_temp.restore or last_extruder1_temp.restore %}
|
||||||
|
{ client.user_temp_macro|default("") }
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% elif can_extrude %}
|
||||||
|
{% set do_resume = True %}
|
||||||
|
{% endif %}
|
||||||
|
_ACT_RESUME DO_RESUME={ do_resume }
|
||||||
|
{% endmacro %}
|
||||||
|
{% if printer['gcode_button _door_detection'] %}
|
||||||
|
{% set sv = printer.save_variables.variables %}
|
||||||
|
{% set door_function = sv.door_detect|default("Disabled") %}
|
||||||
|
{% set door_state = printer['gcode_button _door_detection'].state|default('released')|lower %}
|
||||||
|
|
||||||
|
{% if door_function == 'Pause Print' and door_state == 'pressed' %}
|
||||||
|
{ resume_action() }
|
||||||
|
{% elif door_function == 'Pause Print' and door_state == 'released' %}
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_begin"
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_text Please close the door and click Resume to proceed."
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end"
|
||||||
|
RESPOND TYPE=command MSG="action:prompt_show"
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{ resume_action() }
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if last_extruder_temp.restore or last_extruder1_temp.restore %}
|
|
||||||
{client.user_temp_macro|default("")}
|
|
||||||
{% set do_resume = True %}
|
|
||||||
{% elif can_extrude %}
|
|
||||||
{% set do_resume = True %}
|
|
||||||
{% endif %}
|
|
||||||
_ACT_RESUME DO_RESUME={do_resume}
|
|
||||||
|
|
||||||
[gcode_macro _ACT_RESUME]
|
[gcode_macro _ACT_RESUME]
|
||||||
gcode:
|
gcode:
|
||||||
@ -1147,3 +1168,5 @@ gcode:
|
|||||||
gcode:
|
gcode:
|
||||||
RUN_SHELL_COMMAND CMD=fetch_assets PARAMS="\"Gcode\" \"D600Pro2HS\" \"NozzleAglin.zip\""
|
RUN_SHELL_COMMAND CMD=fetch_assets PARAMS="\"Gcode\" \"D600Pro2HS\" \"NozzleAglin.zip\""
|
||||||
SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode"
|
SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode"
|
||||||
|
|
||||||
|
[include module/*.cfg]
|
||||||
|
32
config/module/door_detect.cfg
Normal file
32
config/module/door_detect.cfg
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[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"
|
Loading…
x
Reference in New Issue
Block a user