## HELPERS [gcode_macro ZES] description: Z_ENDSTOP_CALIBRATE + extras gcode: G28 G0 X150 Y150 Z10 F10000 Z_ENDSTOP_CALIBRATE TESTZ Z=-9 [gcode_macro CENTER] gcode: {% set X=params.X|default(150) %} {% set Y=params.Y|default(150) %} {% set Z=params.Z|default(25) %} {% if "xyz" in printer.toolhead.homed_axes %} G0 X{X} Y{Y} Z{Z} F10000 {% else %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro PURGE_NOZZLE] gcode: {% set x0=params.x0|default(75) %} {% set x1=params.x1|default(225) %} {% set y0=params.y0|default(15) %} {% set y1=params.y1|default(15.8) %} M117 > purge nozzle G0 Z10 F300 # move Z to travel height G0 X{x0} Y{y0} F5000 # move to x0/y0 G0 Z0.2 F1500 # lower Z G0 X{x1} E30 # draw line G0 Y{y1} # move to y1 G0 X{x0} E15 # draw fine line [gcode_macro BRUSHIE] gcode: {% set x0=50 %} {% set x1=110 %} {% set y0=305 %} {% set z0=2 %} {% if "xyz" in printer.toolhead.homed_axes %} M117 > brushie brushie brushie G0 Z20 F1000 # move Z to travel height G0 X{x0} Y{y0} F5000 # move to x0/y0 G0 Z{z0} # lower G0 X{x1} # back G0 X{x0} # forth G0 X{x1} # back G0 Z20 F300 # move Z to travel height {% else %} {action_respond_info("Printer not homed")} {% endif %} [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 max_z = printer.toolhead.axis_maximum.z|float %} {% set act_z = printer.toolhead.position.z|float %} {% if act_z < (max_z - 20.0) %} {% set z_safe = 20.0 %} {% else %} {% set z_safe = max_z - act_z %} {% endif %} G91 G0 Z{z_safe} F900 G90 G0 X{x_park} Y{y_park} F6000 {% else %} {action_respond_info("Printer not homed")} {% endif %} [gcode_macro M600] description: Change filament gcode: SAVE_GCODE_STATE NAME=M600_state PAUSE Y=15 M117 > change filament RESTORE_GCODE_STATE NAME=M600_state ## PRINT_ [gcode_macro PRINT_START] gcode: {% set BED=params.BED|default(100) %} {% set EXTRUDER=params.EXTRUDER|default(250) %} {% set QGL=params.QGL|default(1)|int %} {% set BMC=params.BMC|default(0)|int %} {% set PURGE=params.PURGE|default(1)|int %} {% set SOAK=params.SOAK|default(0)|int * 1000 * 60 %} {% set Z_ADJUST=params.Z_ADJUST|default(0.0)|float %} # TODO {% set ERCF=params.ERCF|default(0) %} M117 > configuring SET_LED LED=caselight RED=0.00 GREEN=0.00 BLUE=0.50 G4 P2000 SET_GCODE_OFFSET Z=0.0 # reset z offset M140 S{BED} # start bed heating 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 M117 > homing SET_LED LED=caselight RED=0.00 GREEN=0.50 BLUE=0.00 G4 P2000 {% if BMC %} BED_MESH_CLEAR {% endif %} M117 > home G28 {% if QGL %} M117 > qgl QUAD_GANTRY_LEVEL {% endif %} M117 > brushie BRUSHIE M117 > calibrate z CALIBRATE_Z {% if BMC %} M117 > bed mesh calibrate BED_MESH_CALIBRATE {% else %} M117 > bed mesh load BED_MESH_PROFILE LOAD=default {% endif %} M117 > heating SET_LED LED=caselight RED=0.50 GREEN=0.00 BLUE=0.00 G4 P2000 G92 E0 # reset extruder M190 S{BED} # set and wait for bed temperature M109 S{EXTRUDER} # set and wait for nozzle temperature {% if SOAK > 0 %} M117 > soaking for {SOAK/1000/60|int} min G4 P{SOAK} {% endif %} M117 > starting SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1 SET_LED LED=caselight RED=0.50 GREEN=0.50 BLUE=0.50 G4 P2000 {% if PURGE %} PURGE_NOZZLE {% endif %} [gcode_macro PRINT_END] gcode: M117 > finished PARK M400 ; wait for buffer to clear G92 E0 ; zero the extruder G1 E-10.0 F3600 ; retract filament TURN_OFF_HEATERS M107 ; turn off fan [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 ## OVERRIDES [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 Y=params.Y|default(295) %} # read E from pause macro {% set E = printer["gcode_macro PAUSE"].extrude|float %} # end of definitions M117 > pause PAUSE_BASE {% if printer.extruder.can_extrude|lower == 'true' %} G91 G1 E-{E} F2100 G90 {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} PARK Y={Y} [gcode_macro RESUME] description: Resume the actual running print rename_existing: RESUME_BASE gcode: # 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 M117 > resume {% if printer.extruder.can_extrude|lower == 'true' %} G91 G1 E{E} F6000 {% else %} {action_respond_info("Extruder not hot enough")} {% endif %} RESUME_BASE {get_params} [gcode_macro CANCEL_PRINT] description: Cancel the actual running print rename_existing: CANCEL_PRINT_BASE gcode: TURN_OFF_HEATERS PARK CANCEL_PRINT_BASE [gcode_macro PROBE] description: Override PROBE and make sure we're over the bed rename_existing: PROBE_BASE gcode: {% set P = printer["gcode_macro _Probe_Variables"].probe_attached %} {% if printer.toolhead.position.y|float > 270 %} G0 Y270 {% endif %} {% if P %} PROBE_BASE {% else %} {action_respond_info("Probe not attached")} {% endif %} [gcode_macro PROBE_CALIBRATE] description: Override PROBE_CALIBRATE and make sure we're over the bed rename_existing: PROBE_CALIBRATE_BASE gcode: {%- if printer.toolhead.position.y|float > 270 -%} G0 Y270 {%- endif -%} PROBE_CALIBRATE_BASE