diff --git a/config/CreatBot_D1000/1.1/door_detect.cfg b/config/CreatBot_D1000/1.1/door_detect.cfg new file mode 100644 index 000000000..bbafd803f --- /dev/null +++ b/config/CreatBot_D1000/1.1/door_detect.cfg @@ -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" diff --git a/config/CreatBot_D1000/base.cfg b/config/CreatBot_D1000/base.cfg index 78cd8530b..71f1fed49 100644 --- a/config/CreatBot_D1000/base.cfg +++ b/config/CreatBot_D1000/base.cfg @@ -10,6 +10,10 @@ filename: ~/printer_data/config/config_variables.cfg [exclude_object] +[board_pins] +aliases: + DOOR_PIN=PC5 + [gcode_arcs] resolution: 1.0 @@ -787,24 +791,41 @@ gcode: {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} {% set do_resume = False %} {% set runout = True %} - ##### end of definitions ##### - _FILAMENT_UPDATE - _RESUME_EXTRUDER AUTOSHIFT={autoshift} - _EXTRUDER_TEMPERATURE_HANDLE + {% macro resume_action() %} + _FILAMENT_UPDATE + _RESUME_EXTRUDER AUTOSHIFT={autoshift} + _EXTRUDER_TEMPERATURE_HANDLE - {% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config - else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder - #### Printer comming from timeout idle state #### - {% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %} - SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=Fals + {% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config + else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder + #### Printer comming from timeout idle state #### + {% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %} + 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 %} - {% 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: @@ -1137,4 +1158,6 @@ gcode: [gcode_macro _NOZZLE_XY_OFFSET_CALIBRATE] gcode: RUN_SHELL_COMMAND CMD=fetch_assets PARAMS="\"Gcode\" \"D1000HS\" \"NozzleAglin.zip\"" - SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode" \ No newline at end of file + SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode" + +[include module/*.cfg] diff --git a/config/CreatBot_D600Pro2/1.1/door_detect.cfg b/config/CreatBot_D600Pro2/1.1/door_detect.cfg new file mode 100644 index 000000000..bbafd803f --- /dev/null +++ b/config/CreatBot_D600Pro2/1.1/door_detect.cfg @@ -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" diff --git a/config/CreatBot_D600Pro2/base.cfg b/config/CreatBot_D600Pro2/base.cfg index 0e775e6cb..e40abfbdb 100644 --- a/config/CreatBot_D600Pro2/base.cfg +++ b/config/CreatBot_D600Pro2/base.cfg @@ -10,6 +10,10 @@ filename: ~/printer_data/config/config_variables.cfg [exclude_object] +[board_pins] +aliases: + DOOR_PIN=PC5 + [gcode_arcs] resolution: 1.0 @@ -778,25 +782,42 @@ gcode: {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} {% set do_resume = False %} {% set runout = True %} - ##### end of definitions ##### - _FILAMENT_UPDATE - _RESUME_EXTRUDER AUTOSHIFT={autoshift} - _EXTRUDER_TEMPERATURE_HANDLE + {% macro resume_action() %} + _FILAMENT_UPDATE + _RESUME_EXTRUDER AUTOSHIFT={autoshift} + _EXTRUDER_TEMPERATURE_HANDLE - {% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config - else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder + {% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config + else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder - #### Printer comming from timeout idle state #### - {% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %} - SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=Fals + #### Printer comming from timeout idle state #### + {% if printer.idle_timeout.state|upper == "IDLE" or idle_state or autoshift %} + 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 %} - {% 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: @@ -1129,4 +1150,6 @@ gcode: [gcode_macro _NOZZLE_XY_OFFSET_CALIBRATE] gcode: RUN_SHELL_COMMAND CMD=fetch_assets PARAMS="\"Gcode\" \"D600Pro2HS\" \"NozzleAglin.zip\"" - SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode" \ No newline at end of file + SDCARD_PRINT_FILE FILENAME=".PresetModel/NozzleAglin.gcode" + +[include module/*.cfg] diff --git a/config/module/door_detect.cfg b/config/module/door_detect.cfg new file mode 100644 index 000000000..bbafd803f --- /dev/null +++ b/config/module/door_detect.cfg @@ -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"