[gcode_macro PRINT_START] # Use PRINT_START for the slicer starting script - please customize for your slicer of choice gcode: # Slicer Parameters {% set hotendTemp = params.HOTEND|int %} {% set bedTemp = params.BED|int %} {% set chamberTemp = params.CHAMBER|default(0)|int %} {% set OFFSET = params.offset|default(0)|float %} SET_LED LED="tinytemp" RED=0.0196 GREEN=0 BLUE=0.0196 SYNC=0 TRANSMIT=1 # Turn on light to indicate printing BED_MESH_CLEAR SET_GCODE_OFFSET Z=0 SET_HEATER_TEMPERATURE HEATER=extruder TARGET=150 # Set extruder chamber warm temp #SET_HEATER_TEMPERATURE HEATER=extruder TARGET={hotendTemp|float*0.6} # Set extruder chamber warm temp SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={bedTemp} # Set bed temp to warm while starting up G28 # home after setting temps M117 Waiting for bed temperature... TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bedTemp} MAXIMUM={bedTemp+1} # Wait for bed temp (within 1 degree) {% if chamberTemp != 0 %} # If chamber temp set SET_CHAMBER_TEMP CHAMBER={chamberTemp} # Set target chamber temp CHAMBER_WARMER TEMPERATURE={chamberTemp-5} BED={bedtemp} # Prewarm chamber {% endif %} G4 P{60*100} # Let temps settle for 60s FAST_QGL # QGL after soak BED_MESH_CALIBRATE G90 # Absolute positioning SMART_PARK M109 S{hotendTemp} # Set extruder to printing temperature SET_GCODE_OFFSET Z=0.20 # add a little offset for hotend thermal expansion # needs fine tuning, long meltzones require more SET_GCODE_OFFSET Z_ADJUST={OFFSET} # apply optional material squish via slicer G1 X{90} F{500*60} # Avoid brush VORON_PURGE # Purge M117 Printing... [gcode_macro CHAMBER_WARMER] description: Uses the bed and part cooling fan to warm the chamber gcode: # User Parameters {% set z_pcf_height = 5 %} # Height from the bed while warming {% set fan_speed = 100 %} # Fan speed in percent {% set bedTemp = params.BED|default(110)|int %} {% set chamberTemp = params.TEMPERATURE|default(0)|int %} {% if printer["temperature_sensor chamber"].temperature < chamberTemp %} BEDFANSMAX # Force bed fans to max speed # Only move and turn on fan if chamber is not to temp. G90 # Absolute positioning # park above bed center G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z{z_pcf_height} M106 S{fan_speed / 100 * 255} # Max out part cooling to cycle chamber air M117 Waiting for chamber temperature {chamberTemp}c... TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={chamberTemp} # Wait for chamber temp M106 S0 # Disable part cooling fan after soak G4 {20*1000} # Wait for bed to recover temp {% endif %} M117 Chamber at temp [gcode_macro PARK] gcode: SMART_PARK #GO_TO_BUCKET [gcode_macro GO_TO_BUCKET] gcode: {% set X = 18 %} {% set Y = 184 %} {% set Z = 2 %} ########### SAFE_RETRACT {% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %} # Tall hop if low {% if printer.toolhead.position.z < 15 %} G90 G1 Z15 # Short hop if high {% elif printer.toolhead.position.z < (max_z - Z - 1) %} G91 G1 Z{Z} {% endif %} G90 G1 X{X} F{500*60} G1 Y{Y} F{500*60} G91 [gcode_macro G32] gcode: SAVE_GCODE_STATE NAME=STATE_G32 G90 G28 QUAD_GANTRY_LEVEL G28 PARK RESTORE_GCODE_STATE NAME=STATE_G32 [gcode_macro PRINT_END] # Use PRINT_END for the slicer ending script - please customise for your slicer of choice gcode: # safe anti-stringing move coords {% set th = printer.toolhead %} {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %} {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %} {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %} SAVE_GCODE_STATE NAME=STATE_PRINT_END M400 ; wait for buffer to clear G92 E0 ; zero the extruder G1 E-5.0 F1800 ; retract filament TURN_OFF_HEATERS G90 ; absolute positioning G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear M107 ; turn off fan BED_MESH_CLEAR #GO_TO_BUCKET RESTORE_GCODE_STATE NAME=STATE_PRINT_END SET_LED LED="tinytemp" RED=0 GREEN=0 BLUE=0 SYNC=0 TRANSMIT=1 # Turn of light to indicate not printing [gcode_macro CANCEL_PRINT] rename_existing: BASE_CANCEL_PRINT gcode: #M106 S0 #TURN_OFF_HEATERS CLEAR_PAUSE SDCARD_RESET_FILE #BASE_CANCEL_PRINT #BED_MESH_CLEAR PRINT_END [gcode_macro PAUSE] rename_existing: BASE_PAUSE gcode: #Edit this# {% set Z = 2 %} ########### SAVE_GCODE_STATE NAME=PAUSE_state BASE_PAUSE G91 SAFE_RETRACT G1 Z{Z} SMART_PARK #GO_TO_BUCKET G91 [gcode_macro RESUME] rename_existing: BASE_RESUME gcode: #Edit this# {% set Z = 10 %} ########### G91 G1 Z{Z} G91 RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 BASE_RESUME [gcode_macro FAST_QGL] gcode: {% set z_offset = 2 %} # Home first if needed {% if printer.toolhead.homed_axes != "xyz" %} G28 METHOD=PROXIMITY QUAD_GANTRY_LEVEL horizontal_move_z=7 retry_tolerance=1 PROBE_METHOD=PROXIMITY {% endif %} QUAD_GANTRY_LEVEL horizontal_move_z={z_offset} PROBE_METHOD=PROXIMITY G28 Z BEACON_AUTO_CALIBRATE [gcode_macro SAFE_RETRACT] gcode: {% if printer.extruder.can_extrude %} G10 {% endif %} [gcode_macro SAFE_UNRETRACT] gcode: {% if printer.extruder.can_extrude %} G11 {% endif %} [gcode_macro UNLOAD_FILAMENT] gcode: M118 Filament unloading! M117 Filament unloading! M82 # Set extruder to absolute mode G92 E0 {% if printer.extruder.can_extrude|lower != 'true' %} # Checking for minimum extrusion temperature # Check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185) M118 Hotend heating! M109 S235 T0 # Set temperature and wait {% endif %} G1 E10 F{5*60} # Extrude a little to soften tip G0 E-5 F{60*60} # Extract filament to cold end G0 E-70 F{5*60} # Continue extraction slow allow filament to be cooled enough before reaches the gears M400 M118 Filament unload complete! M117 Filament unload complete! [gcode_macro M109] rename_existing: M99109 gcode: #Parameters {% set s = params.S|float %} M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set hotend temp {% if s != 0 %} TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+5} ; Wait for hotend temp (within 5 degrees) {% endif %} [gcode_macro TEST_SPEED] gcode: # Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 Z=10 # Speed {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} # Iterations {% set iterations = params.ITERATIONS|default(1)|int %} # Acceleration {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} # Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions) {% set bound = params.BOUND|default(30)|int %} # Size for small pattern box {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} {% set z_pos = params.ZPOS|default(10)|int %} # Large pattern # Max positions, inset by BOUND {% set x_min = printer.toolhead.axis_minimum.x + bound %} {% set x_max = printer.toolhead.axis_maximum.x - bound %} {% set y_min = printer.toolhead.axis_minimum.y + bound %} {% set y_max = printer.toolhead.axis_maximum.y - bound %} # Small pattern at center # Find X/Y center point {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %} {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %} # Set small pattern box around center point {% set x_center_min = x_center - (smallpatternsize/2) %} {% set x_center_max = x_center + (smallpatternsize/2) %} {% set y_center_min = y_center - (smallpatternsize/2) %} {% set y_center_max = y_center + (smallpatternsize/2) %} # Home first G28 # Save current gcode state (absolute/relative, etc) SAVE_GCODE_STATE NAME=TEST_SPEED # Output parameters to g-code terminal { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } # Absolute positioning G90 # Set new limits SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel} # Go to starting position G0 X{x_min} Y{y_min} Z{z_pos} F{speed*60} {% for i in range(iterations) %} # Large pattern # Diagonals G0 X{x_min} Y{y_min} F{speed*60} G0 X{x_max} Y{y_max} F{speed*60} G0 X{x_min} Y{y_min} F{speed*60} G0 X{x_max} Y{y_min} F{speed*60} G0 X{x_min} Y{y_max} F{speed*60} G0 X{x_max} Y{y_min} F{speed*60} # Box G0 X{x_min} Y{y_min} F{speed*60} G0 X{x_min} Y{y_max} F{speed*60} G0 X{x_max} Y{y_max} F{speed*60} G0 X{x_max} Y{y_min} F{speed*60} # Small pattern # Small diagonals G0 X{x_center_min} Y{y_center_min} F{speed*60} G0 X{x_center_max} Y{y_center_max} F{speed*60} G0 X{x_center_min} Y{y_center_min} F{speed*60} G0 X{x_center_max} Y{y_center_min} F{speed*60} G0 X{x_center_min} Y{y_center_max} F{speed*60} G0 X{x_center_max} Y{y_center_min} F{speed*60} # Small box {% for i in range(4) %} G0 X{x_center_min} Y{y_center_min} F{speed*60} G0 X{x_center_min} Y{y_center_max} F{speed*60} G0 X{x_center_max} Y{y_center_max} F{speed*60} G0 X{x_center_max} Y{y_center_min} F{speed*60} {% endfor %} {% endfor %} # Restore max speed/accel/accel_to_decel to their configured values SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} # Restore previous gcode state (absolute/relative, etc) RESTORE_GCODE_STATE NAME=TEST_SPEED