Skip to content

Instantly share code, notes, and snippets.

@pm0u
Created March 14, 2025 23:14
Show Gist options
  • Save pm0u/85b696c9a61e66d7c0e8d8d6de930493 to your computer and use it in GitHub Desktop.
Save pm0u/85b696c9a61e66d7c0e8d8d6de930493 to your computer and use it in GitHub Desktop.
[gcode_macro PRINT_START]
gcode:
{% set bedtemp = params.BED|int %}
{% set hotendtemp = params.HOTEND|int %}
{% set chambertemp = params.CHAMBER|default(0)|int %}
SET_GCODE_VARIABLE MACRO=_APPLY_NOZZLE_OFFSET VARIABLE=hotend_temp VALUE={hotendtemp}
M140 S{bedtemp} # Initiate Print Bed Warmup as early as possible
M400 # Wait for all prior G-code commands to be processed by MCU
M104 S0 # Make sure hotend is off
M106 P3 S0 # Turn off chamber circulation/exhaust fan
M400 # Wait for all prior G-code commands to processed before G28
G28 # Home all axes
CLEAR_NOZZLE HOTEND={hotendtemp} # Do nozzle purge and wipe
M190 S{bedtemp} # Wait for print bed to reach target temperature
G29 # Mesh and Z offset (bed at temp, chamber cold)
{% if chambertemp > 0 %} # Special chamber handling for fastest thorough warmup times
M106 P0 S255 # Ensure part cooling fan is full speed for better air mixing
M106 P2 S255 # Ensure AUX is at 100% after CLEAR_NOZZLE was called
G0 Z5 F600 # Bring print bed to Z=5mm. This helps with chamber heating
G0 X152 Y152 F6000 # Bring print head to middle of print bed
M191 S{chambertemp-5} # Wait for chamber to reach 5C less than the target temperature
M141 S{chambertemp} # Reset chamber target to full target
M106 P2 S0 # Turn off AUX Fan
M106 P0 S0 # Turn off part cooling fan
{% endif %}
G0 Z5 F600 # Move plate to Z=5mm
G0 X5 Y5 F6000 # Move print head to front-left
#SMART_PARK # KAMP Smart Park instead
M109 S{hotendtemp} # Commence hotend warmup
M204 S10000 # Set velocity limits
SET_PRINT_STATS_INFO CURRENT_LAYER=1
ENABLE_ALL_SENSOR
save_last_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment