######################################## # M600 Support ######################################## [respond] [idle_timeout] gcode: {% if printer["gcode_macro M600"].m600_state == 1 %} RESPOND TYPE=command MSG="Stopping hotend heating..." M104 S0 {% else %} TURN_OFF_HEATERS M84 {% endif %} timeout: 1800 [filament_switch_sensor filament_sensor] pause_on_runout: false switch_pin: !PC15 runout_gcode: M600 [gcode_macro _UNLOAD_FILAMENT] gcode: RESTORE_E_CURRENT M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} RESPOND TYPE=command MSG="Unloading filament..." M83 G1 E10 F300 G1 E-15 F3000 G1 E-22.4700 F2400 G1 E-6.4200 F1200 G1 E-3.2100 F720 G1 E5.0000 F356 G1 E-5.0000 F384 G1 E5.0000 F412 G1 E-5.0000 F440 G1 E5.0000 F467 G1 E-5.0000 F495 G1 E5.0000 F523 G1 E-5.0000 F3000 G1 E-15 F3000 SET_E_MIN_CURRENT [gcode_macro _LOAD_FILAMENT] gcode: RESTORE_E_CURRENT M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} RESPOND TYPE=command MSG="Loading filament..." G91 G1 E100 F180 G90 M400 SET_E_MIN_CURRENT [gcode_macro _PURGE_MORE] gcode: RESTORE_E_CURRENT M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} RESPOND TYPE=command MSG="Purging filament..." G91 G1 E10 F180 G90 M400 SET_E_MIN_CURRENT [gcode_macro M600] description: Filament Change variable_m600_state: 0 variable_fan0_speed: 0 gcode: {% set E = printer["gcode_macro PAUSE"].extrude|float %} {% set y_park = printer.toolhead.axis_minimum.y|float + 5.0 %} {% set x_park = printer.toolhead.axis_maximum.x|float - 10.0 %} {% set max_z = printer["gcode_macro PRINTER_PARAM"].max_z_position|float %} {% set act_z = printer.toolhead.position.z|float %} {% set z_safe = 0.0 %} {% if act_z < 48.0 %} {% set z_safe = 50.0 - act_z %} {% elif act_z < (max_z - 2.0) %} {% set z_safe = 2.0 %} {% elif act_z < max_z %} {% set z_safe = max_z - act_z %} {% endif %} {action_respond_info("z_safe = %s"% (z_safe))} SET_GCODE_VARIABLE MACRO=M600 VARIABLE=m600_state VALUE=1 SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=hotend_temp VALUE={printer.extruder.target} SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=z_safe_pause VALUE={z_safe|float} RESPOND TYPE=command MSG="Print paused for filament change!" PAUSE_BASE G91 {% if "xyz" in printer.toolhead.homed_axes %} {% if printer.extruder.can_extrude|lower == 'true' %} G1 E-1.0 F180 G1 E-{E} F4000 {% else %} RESPOND TYPE=command MSG="Extruder not hot enough!" {% endif %} G1 Z{z_safe} F600 M400 G90 G1 X{x_park} Y{y_park} F30000 {% endif %} _UNLOAD_FILAMENT SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=fan2_speed VALUE={printer['output_pin fan2'].value} SET_GCODE_VARIABLE MACRO=M600 VARIABLE=fan0_speed VALUE={printer['output_pin fan0'].value} M106 P0 S0 M106 P2 S0 SET_IDLE_TIMEOUT TIMEOUT=900 SET_E_MIN_CURRENT RESPOND TYPE=command MSG="action:prompt_begin Filament change detected!" RESPOND TYPE=command MSG="action:prompt_text A necessary filament change has been detected. Please replace filament, LOAD it and click RESUME button." RESPOND TYPE=command MSG="action:prompt_button UNLOAD FILAMENT|_UNLOAD_FILAMENT|secondary" RESPOND TYPE=command MSG="action:prompt_button LOAD FILAMENT|_LOAD_FILAMENT|secondary" RESPOND TYPE=command MSG="action:prompt_button PURGE MORE FILAMENT|_PURGE_MORE|secondary" RESPOND TYPE=command MSG="action:prompt_footer_button CANCEL PRINT|CANCEL_PRINT|error" RESPOND TYPE=command MSG="action:prompt_footer_button IGNORE|RESPOND TYPE=command MSG=action:prompt_end|warning" RESPOND TYPE=command MSG="action:prompt_footer_button RESUME|RESUME|primary" RESPOND TYPE=command MSG="action:prompt_show" [gcode_macro RESUME] description: Resume the current print rename_existing: RESUME_BASE gcode: RESTORE_E_CURRENT {% if printer['gcode_macro PRINTER_PARAM'].hotend_temp|int != 0 %} {% if printer['gcode_macro PRINTER_PARAM'].hotend_temp|int > printer.extruder.temperature %} RESPOND TYPE=command MSG="Starting hotend heating..." M109 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} {% else %} RESPOND TYPE=command MSG="Starting hotend heating..." M104 S{printer['gcode_macro PRINTER_PARAM'].hotend_temp|int} {% endif %} SET_GCODE_VARIABLE MACRO=PRINTER_PARAM VARIABLE=hotend_temp VALUE=0 {% endif %} {% if printer['gcode_macro PRINTER_PARAM'].fan2_speed > 0 %} {% set s_value = (printer['gcode_macro PRINTER_PARAM'].fan2_speed * 255 - printer['gcode_macro PRINTER_PARAM'].fan2_min) * 255 / (255 - printer['gcode_macro PRINTER_PARAM'].fan2_min)|float %} M106 P2 S{s_value} {% endif %} {% if printer['gcode_macro M600'].m600_state != 1 %} {% set z_resume_move = printer['gcode_macro PRINTER_PARAM'].z_safe_pause|int %} {% if z_resume_move > 2 %} {% set z_resume_move = z_resume_move - 2 %} G91 G1 Z-{z_resume_move} F600 M400 {% endif %} {% endif %} {% set E = printer["gcode_macro PAUSE"].extrude|float + 1.0 %} {% if 'VELOCITY' in params|upper %} {% set get_params = ('VELOCITY=' + params.VELOCITY) %} {%else %} {% set get_params = "" %} {% endif %} {% if printer["gcode_macro M600"].m600_state == 1 %} {% if printer['gcode_macro M600'].fan0_speed > 0 %} {% set s_value = (printer['gcode_macro M600'].fan0_speed * 255 - printer['gcode_macro PRINTER_PARAM'].fan0_min) * 255 / (255 - printer['gcode_macro PRINTER_PARAM'].fan0_min)|float %} M106 P0 S{s_value} SET_GCODE_VARIABLE MACRO=M600 VARIABLE=fan0_speed VALUE=0 {% endif %} SET_GCODE_VARIABLE MACRO=M600 VARIABLE=m600_state VALUE=0 SET_IDLE_TIMEOUT TIMEOUT=1800 RESPOND TYPE=command MSG="action:prompt_end" {% else %} {% if printer.extruder.can_extrude|lower == 'true' %} G91 G1 E{E} F2100 G90 M400 {% else %} RESPOND TYPE=command MSG="Extruder not hot enough!" {% endif %} {% endif %} RESPOND TYPE=command MSG="Resuming printing..." RESUME_BASE {get_params}