#################################################################### # Macros used for printing # - BRUSHIE # - CANCEL_PRINT # - M600 # - M900 # - PARK # - PAUSE # - PRINT_START # - PRINT_END # - PURGE_NOZZLE # - RESUME #################################################################### # BRUSHIE [gcode_macro BRUSHIE] gcode: {% set x0=250 %} {% set x1=200 %} {% set y0=309 %} {% set z0=1.5 %} {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} {% if "xyz" in printer.toolhead.homed_axes %} G0 Z{z_hop} F1000 # move Z to travel height G0 X{x0} Y{y0} F6000 # move to x0/y0 G0 Z{z0} # lower G0 X{x1} # 1 G0 X{x0} # 2 G0 X{x1} # 3 G0 Z{z_hop} F300 # move Z to travel height {% else %} M118 Printer not homed {% endif %} # # - CANCEL_PRINT [gcode_macro CANCEL_PRINT] description: Cancel the actual running print rename_existing: _CANCEL_PRINT_BASE gcode: SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 CLEAR_PAUSE SDCARD_RESET_FILE TURN_OFF_HEATERS PARK _CANCEL_PRINT_BASE [gcode_macro M600] description: Change filament gcode: SAVE_GCODE_STATE NAME=M600_state PAUSE Y=15 M118 M600 change filament RESTORE_GCODE_STATE NAME=M600_state [gcode_macro M900] description: Set pressure advance gcode: SET_PRESSURE_ADVANCE ADVANCE={params.K|default(0)} # PARK [gcode_macro PARK] gcode: {% set Y=params.Y|default(295) %} {% if "xyz" in printer.toolhead.homed_axes %} # set park positon for x and y ## close to max {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} {% if Y != y_park %} {% set y_park = Y %} {% endif %} # calculate save lift position {% set z_max = printer.toolhead.axis_maximum.z|float %} {% set z_act = printer.toolhead.position.z|float %} {% set z_safe = z_act + 10 %} {% if z_safe > z_max %} {% set z_safe = z_max %} {% endif %} G91 G0 Z{z_safe} F1200 G90 G0 X{x_park} Y{y_park} F6000 {% else %} 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 G90 {% else %} M118 Extruder not hot enough {% endif %} # - PRINT_START [gcode_macro PRINT_START] gcode: {% set BED=params.BED|default(100)|int %} {% set BED10=params.BED|default(100)|int - 10 %} {% set EXTRUDER=params.EXTRUDER|default(250)|int %} {% set BMC=params.BMC|default(0)|int %} {% set SHEET=params.SHEET|default("default")|string %} {% set PURGE=params.PURGE|default(1)|int %} {% set Z_ADJUST=params.Z_ADJUST|default(0.0)|float %} {% set ERCF=params.ERCF|default(0)|int %} {% set ERCF_EXTRUDER=params.ERCF_EXTRUDER|default(0)|int %} {action_respond_info("starting print BED=%d, EXTRUDER=%d, SHEET=%s, BMC=%d, PURGE=%d, Z_AJUST=%f, ERCF=%d, ERCF_EXTRUDER=%d" % (BED, EXTRUDER, SHEET, BMC, PURGE, Z_ADJUST, ERCF, ERCF_EXTRUDER))} M117 CONFIGURING M118 CONFIGURING SET_GCODE_OFFSET Z=0.0 # reset z offset M140 S{BED10} # start bed heating to bed-10 # M104 S{EXTRUDER} # start extruder heating G92 E0 # reset extruder G21 # set units to millimeters G90 # use absolute coordinates 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 %} {% if BMC %} M117 BED MESH CALIBRATE M118 BED MESH CALIBRATE BED_MESH_CALIBRATE {% else %} M117 BED MESH LOAD {SHEET} M118 BED MESH LOAD {SHEET} BED_MESH_PROFILE LOAD={SHEET} {% endif %} M117 CALIBRATE_Z M118 CALIBRATE_Z BRUSHIE CALIBRATE_Z G92 E0 # reset extruder NOTIFY_BED BED={BED10} M190 S{BED10} # set and wait for bed-10 temperature NOTIFY_EXTRUDER EXTRUDER={EXTRUDER} M104 S{EXTRUDER} # start extruder heating NOTIFY_BED BED={BED} M190 S{BED} # set and wait for actual bed temperature M109 S{EXTRUDER} # set and wait for extruder temperature SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1 {% if ERCF %} M117 ercf changing to tool {ERCF_EXTRUDER} M118 ercf changing to tool {ERCF_EXTRUDER} ERCF_HOME ERCF_CHANGE_TOOL_SLICER TOOL={ERCF_EXTRUDER} {% endif %} BRUSHIE {% if PURGE %} PURGE_NOZZLE {% endif %} M117 STARTING M118 STARTING # - PRINT_END [gcode_macro PRINT_END] gcode: {% set UNLOAD_AT_END=params.UNLOAD_AT_END|default(0)|int %} M118 finished PARK M400 ; wait for buffer to clear G92 E0 ; zero the extruder G1 E-10.0 F3600 ; retract filament {% if UNLOAD_AT_END == 1 %} ERCF_EJECT {% endif %} TURN_OFF_HEATERS M107 ; turn off fan # - PURGE_NOZZLE [gcode_macro PURGE_NOZZLE] gcode: {% set x0=params.x0|default(100) %} {% set x1=params.x1|default(200) %} {% set y0=params.y0|default(2) %} {% set y1=params.y1|default(3) %} {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} M118 purge nozzle G0 Z{z_hop} F300 # move Z to travel height G0 X{x0} Y{y0} F5000 # move to x0/y0 G0 Z0.24 F300 # lower Z to 75% G0 X{x1} E20 F1500 # draw line G0 Y{y1} # move to y1 G0 X{x0} E10 # draw fine line G0 X{x0-10} # move a little further G0 E-5 # retract filament G0 Z{z_hop} F300 # move Z to travel height # - RESUME [gcode_macro RESUME] 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 {% else %} M118 Extruder not hot enough {% 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] 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