diff --git a/macros/print.cfg b/macros/print.cfg index 7d4a81b..b5680de 100644 --- a/macros/print.cfg +++ b/macros/print.cfg @@ -2,12 +2,16 @@ # Macros used for printing # - BRUSHIE # - CANCEL_PRINT +# - LOAD_FILAMENT +# - UNLOAD_FILAMENT # - M600 +# - M601 # - M900 # - PARK # - PAUSE # - PRINT_START # - PRINT_END +# - PRINT_LAYER_CHANGE # - PURGE_NOZZLE # - RESUME #################################################################### @@ -18,7 +22,7 @@ gcode: {% set x0=250 %} {% set x1=200 %} - {% set y0=309.5 %} + {% set y0=308 %} {% set z0=1.0 %} {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} {% if "xyz" in printer.toolhead.homed_axes %} @@ -30,7 +34,7 @@ gcode: G0 X{x1} # 3 G0 Z{z_hop} F300 # move Z to travel height {% else %} - M118 Printer not homed + M118 printer not homed {% endif %} @@ -47,14 +51,29 @@ gcode: _CANCEL_PRINT_BASE +[gcode_macro LOAD_FILAMENT] +gcode: + T0 + + +[gcode_macro UNLOAD_FILAMENT] +gcode: + ERCF_EJECT + + [gcode_macro M600] description: Change filament gcode: SAVE_GCODE_STATE NAME=M600_state - PAUSE Y=15 + PAUSE M118 M600 change filament RESTORE_GCODE_STATE NAME=M600_state +[gcode_macro M601] +description: Pause print +gcode: + PAUSE + [gcode_macro M900] description: Set pressure advance gcode: @@ -85,30 +104,38 @@ gcode: G90 G0 X{x_park} Y{y_park} F6000 {% else %} - M118 Printer not homed + M118 printer not homed {% endif %} # - PAUSE [gcode_macro PAUSE] -description: Pause the actual running print rename_existing: _PAUSE_BASE -# change this if you need more or less extrusion -variable_extrude: 1.0 gcode: - {% set YMIN = printer.toolhead.axis_minimum.y|float + 5.0 %} - {% set Y=params.Y|default(YMIN) %} - # read E from pause macro - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - # end of definitions - M118 pause - _PAUSE_BASE - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E-{E} F2100 + {% if printer.pause_resume.is_paused|lower == 'false' %} + {% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %} + {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} + {% set max_z = printer.toolhead.axis_maximum.z|float %} + {% set act_z = printer.toolhead.position.z|float %} + {% if act_z < (max_z - 5.0) %} + {% set z_safe = 5.0 %} + {% else %} + {% set z_safe = max_z - act_z %} + {% endif %} + G92 E0 + {% if printer.extruder.can_extrude %} + G1 E-1.0 F1500.0 + {% endif %} G90 + SAVE_GCODE_STATE NAME=PAUSE_state + _PAUSE_BASE + G91 + G1 Z{z_safe} F900 + G90 + G0 X{x_park} Y{y_park} F6000 {% else %} - M118 Extruder not hot enough + M117 already paused + M118 already paused {% endif %} @@ -135,24 +162,15 @@ gcode: M83 # use relative distances for extrusion BED_MESH_CLEAR - {% if not "xyz" in printer.toolhead.homed_axes %} - M117 HOME - M118 HOME - G28 - {% else %} - M117 NO HOME - M118 NO HOME - {% endif %} - - {% if printer.quad_gantry_level.applied|lower == 'false' %} - M117 QGL - M118 QGL - QUAD_GANTRY_LEVEL PARK=false - {% else %} - M117 NO QGL - M118 NO QGL - {% endif %} - + # HOME + M117 HOME + M118 HOME + G28 + # QGL + M117 QGL + M118 QGL + QUAD_GANTRY_LEVEL PARK=false + # BMC {% if BMC %} M117 BED MESH CALIBRATE M118 BED MESH CALIBRATE @@ -162,10 +180,10 @@ gcode: M118 BED MESH LOAD {SHEET} BED_MESH_PROFILE LOAD={SHEET} {% endif %} - + # CALIBRATE_Z M117 CALIBRATE_Z M118 CALIBRATE_Z - G28 Z + # G28 Z # irrelevant? BRUSHIE CALIBRATE_Z @@ -230,33 +248,22 @@ gcode: description: Resume the actual running print rename_existing: _RESUME_BASE gcode: - {% if printer["gcode_macro ERCF_PAUSE"].is_paused|int != 0 %} - M118 You can't resume the print without unlocking the ERCF first. - M118 Run ERCF_UNLOCK and solve any issue before hitting Resume again - {% else %} - # read E from pause macro - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - # get VELOCITY parameter if specified - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - # end of definitions - M118 resume - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E{E} F6000 - G90 + {% if printer.pause_resume.is_paused|lower == 'true' %} + {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int != 0 %} + M118 You can't resume the print without unlocking the ERCF first. + M118 Run ERCF_UNLOCK and solve any issue before hitting Resume again + {% else %} + RESTORE_GCODE_STATE NAME=PAUSE_state + G90 + {% if printer["gcode_macro _ERCF_VAR"].clog_detection|int == 1 %} + SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1 + {% endif %} + _RESUME_BASE + {% endif %} {% else %} - M118 Extruder not hot enough + M117 not paused + M118 not paused {% endif %} - {% if printer["gcode_macro ERCF_VAR"].clog_detection|int == 1 %} - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1 - {% endif %} - G4 P2000 - _RESUME_BASE - {% endif %} [gcode_macro PRINT_LAYER_CHANGE] @@ -264,4 +271,4 @@ gcode: {% set layer=params.LAYER|default(0)|int %} {% set layer_z=params.LAYER_Z|default(0) %} {% set total_layer_count=params.TOTAL_LAYER_COUNT|default(0) %} - M117 > layer {layer+1}/{total_layer_count} {layer_z}mm + M117 layer {layer+1}/{total_layer_count} {layer_z}mm