Skip to content

Instantly share code, notes, and snippets.

@rootiest
Last active March 5, 2023 21:01
Show Gist options
  • Save rootiest/e4e4007992c6afef462dfbed65600268 to your computer and use it in GitHub Desktop.
Save rootiest/e4e4007992c6afef462dfbed65600268 to your computer and use it in GitHub Desktop.
# Start G-Code:
#
# START_PRINT BED_TEMP_0={first_layer_bed_temperature[0]} BED_TEMP1={first_layer_bed_temperature[1]} EXTRUDER_TEMP_0={first_layer_temperature[0]} EXTRUDER_TEMP_1={first_layer_temperature[1]} INITIAL_EXTRUDER={initial_extruder} INITIAL_EXTRUDER_TEMP={first_layer_temperature[initial_extruder]} INITIAL_BED_TEMP={first_layer_bed_temperature[initial_extruder]} START_X_MIN={first_layer_print_min[0]} START_Y_MIN={first_layer_print_min[1]} START_X_MAX={first_layer_print_max[0]} START_Y_MAX={first_layer_print_max[1]}
#
#
[gcode_macro START_PRINT]
gcode:
{% set bed_temp_0 = params.BED_TEMP_0|default(60)|float %}
{% set bed_temp_1 = params.BED_TEMP_1|default(60)|float %}
{% set extruder_temp_0 = params.EXTRUDER_TEMP_0|default(200)|float %}
{% set extruder_temp_1 = params.EXTRUDER_TEMP_1|default(200)|float %}
{% set initial_extruder = params.INITIAL_EXTRUDER|default(0)|int %}
{% set initial_extruder_temp = params.INITIAL_EXTRUDER_TEMP|default(200)|int %}
{% set initial_bed_temp = params.INITIAL_BED_TEMP|default(60)|int %}
{% set first_layer_print_min_x = params.START_X_MIN %}
{% set first_layer_print_min_y = params.START_Y_MIN %}
{% set first_layer_print_max_x = params.START_X_MAX %}
{% set first_layer_print_max_y = params.START_Y_MAX %}
; set rpi fan to full
SET_FAN_SPEED FAN=rpi SPEED=1
; set bed temperature
M118{"Bed Set to Temp "}{max(bed_temp_0, bed_temp_1)}
M140 S{max(bed_temp_0, bed_temp_1)}
; set standby temp, extruder 0
{% if extruder_temp_0 > 50 %}
M118{"T0 Set to Standby Temp "}{round(extruder_temp_0*.85)}
M104 S{round(extruder_temp_0*.85)} T0
{% else %}
M118{"T0 Set to Temp Off"}
M104 S0 T0
{% endif %}
; set standby temp, extruder 1
{% if extruder_temp_1 > 50 %}
M118{"T1 Set to Standby Temp "}{round(extruder_temp_1*.85)}
M104 S{round(extruder_temp_1*.85)} T1
{% else %}
M118{"T1 Set to Temp Off "}
M104 S0 T1
{% endif %}
; set initial temp, initial extruder
M118{"T"}[initial_extruder]{" Initial Extruder Set to Temp "}{initial_extruder_temp}
M104 S{initial_extruder_temp} T[initial_extruder]
; heat to temp, bed temperature
M118{"Bed Heating to Temp "}{max(bed_temp_0, bed_temp_1)}
M190 S{max(bed_temp_0, bed_temp_1)}
; heat to temp, initial extruder
M118{"T"}[initial_extruder]{" Initial Extruder Heating to Temp "}{initial_extruder_temp}
M109 S{initial_extruder_temp} T[initial_extruder]
; heat soak, bed temperature
M118{"Bed Heat Soaking to Temp "}{max(bed_temp_0, bed_temp_1)}
G4 P60000
; home, tram gantry, and home
G34
; auto bed leveling
;G29
; auto bed leveling, only active print area
BED_MESH_CALIBRATE PRINT_MIN={first_layer_print_min_x},{first_layer_print_min_y} PRINT_MAX={first_layer_print_max_x},{first_layer_print_max_y} FORCE_NEW_MESH=True
; park extruders
_PARK_extruder1
_PARK_extruder
; initiate extruder
T[initial_extruder]
# End G-Code:
#
# END_PRINT
#
#
[gcode_macro END_PRINT]
gcode:
; zero rpi fan
SET_FAN_SPEED FAN=rpi SPEED=0
; turn off heaters
TURN_OFF_HEATERS
; raise z
G91
G0 Z5 F500
G90
; kill fan
M107
; park extruders
_PARK_extruder1
_PARK_extruder
T0
; present print
BED_PRESENT
; disable steppers
M18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment