Skip to content

Instantly share code, notes, and snippets.

@vvuk
Created September 14, 2024 19:42
Show Gist options
  • Save vvuk/a6007696caa15998ea457486031df29b to your computer and use it in GitHub Desktop.
Save vvuk/a6007696caa15998ea457486031df29b to your computer and use it in GitHub Desktop.
;; remove sovol macros:
;; START_PRINT
;; END_PRINT
;; CLEAN_NOZZLE
;; BED_MESH_CALIBRATE
;; comment out if you _do_ have a Stealthburner (and have the STATUS_X macros)
[include "sb-dummy.cfg"]
[gcode_macro START_PRINT]
variable_state: 'Prepare'
gcode:
# This part fetches data from your slicer. Such as bed temp, extruder temp, chamber temp and size of your printer.
{% set target_bed = params.BED|int %}
{% set target_extruder = params.EXTRUDER|int %}
{% set target_chamber = params.CHAMBER|default("40")|int %}
{% set low_temp_bed_soak_min = params.LOW_TEMP_SOAK_MIN|default("0")|int %}
{% set high_temp_bed_soak_min = params.HIGH_TEMP_SOAK_MIN|default("10")|int %}
{% set x_wait = printer.toolhead.axis_maximum.x|float / 2 %}
{% set y_wait = printer.toolhead.axis_maximum.y|float / 2 %}
{% set have_chamber_thermistor = False %}
# Homes the printer, sets absolute positioning and updates the Stealthburner leds.
STATUS_HOMING # Sets SB-leds to homing-mode
{% if printer.toolhead.homed_axes != "xyz" %}
G28 # Full home (XYZ)
{% endif %}
G90
SMART_PARK
M400
CLEAR_PAUSE
## Uncomment for bed mesh (1 of 2)
BED_MESH_CLEAR # Clears old saved bed mesh (if any)
# Checks if the bed temp is higher than 90c - if so then trigger a heatsoak.
{% if params.BED|int > 90 %}
SET_DISPLAY_TEXT MSG="Bed: {target_bed}C" # Displays info
STATUS_HEATING # Sets SB-leds to heating-mode
M106 S255 # Turns on the PT-fan
## Uncomment if you have a Nevermore.
#SET_PIN PIN=nevermore VALUE=1 # Turns on the nevermore
M190 S{target_bed} # Sets the target temp for the bed
{% if have_chamber_thermistor %}
SET_DISPLAY_TEXT MSG="Heatsoak: {target_chamber}C" # Displays info
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={target_chamber} # Waits for chamber to reach desired temp
{% else %}
SET_DISPLAY_TEXT MSG="Soak: {high_temp_bed_soak_min}m @ {target_bed}C" # Displays info
G4 P{ high_temp_bed_soak_min * 60000 }
{% endif %}
# If the bed temp is not over 90c, then it skips the heatsoak and just heats up to set temp with a 5min soak
{% else %}
SET_DISPLAY_TEXT MSG="Bed: {target_bed}C" # Displays info
STATUS_HEATING # Sets SB-leds to heating-mode
M190 S{target_bed} # Sets the target temp for the bed
SET_DISPLAY_TEXT MSG="Soak: {low_temp_bed_soak_min}m @ {target_bed}C" # Displays info
G4 P{ low_temp_bed_soak_min * 60000 }
{% endif %}
## Uncomment for V2 (Quad gantry level AKA QGL)
SET_DISPLAY_TEXT MSG="QGL" # Displays info
STATUS_LEVELING # Sets SB-leds to leveling-mode
quad_gantry_level # Levels the buildplate via QGL
STATUS_HOMING
G28 Z # Homes Z again after QGL
SMART_PARK
# Heating nozzle to 200 degrees. This helps with getting a correct Z-home
SET_DISPLAY_TEXT MSG="Hotend: 200C" # Displays info
M109 S200 # Heats the nozzle to 200C
STATUS_CLEANING
CLEAN_NOZZLE
## Uncomment for bed mesh (2 of 2)
SET_DISPLAY_TEXT MSG="Bed mesh" # Displays info
STATUS_MESHING # Sets SB-leds to bed mesh-mode
#BED_MESH_CALIBRATE ADAPTIVE=1 METHOD=RAPID_SCAN # Starts bed mesh
BED_MESH_CALIBRATE METHOD=rapid_scan ADAPTIVE=1
STATUS_READY
SMART_PARK
# Heats up the nozzle up to target via data from slicer
SET_DISPLAY_TEXT MSG="Hotend: {target_extruder}C" # Displays info
STATUS_HEATING # Sets SB-leds to heating-mode
M107 # Turns off partcooling fan
M109 S{target_extruder} # Heats the nozzle to printing temp
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=state VALUE='"Start"' # Sovol-ism
STATUS_PRINTING
# Gets ready to print by doing a purge line and updating the SB-leds
SET_DISPLAY_TEXT MSG="Printer goes brr" # Displays info
LINE_PURGE
[gcode_macro END_PRINT]
gcode:
#Get Boundaries
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
#Check end position to determine safe directions to move
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
#Commence END_PRINT
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-4.0 F3600 ; retract
G91 ; relative positioning
G0 Z{z_safe} F3600 ; move nozzle up
M104 S0 ; turn off hotend
M140 S0 ; turn off bed
M106 S0 ; turn off fan
M107 ; turn off part cooling fan
G90 ; absolute positioning
G1 X0 Y360 F9000 ; move nozzle and present
M84 ; Disable all steppers
[gcode_macro CLEAN_NOZZLE]
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
G90
G1 X315 Y360 Z10 F9000
M117 Nozzle heating...
M109 S200
G91
G90
M106 S127
M117 Clean nozzle
G1 Z0.2 F300
G1 X352 F4500
{% for wipes in range(5) %}
G1 Y360 X324
G1 Y360 X345
{% endfor %}
G1 Z5
G1 Z0.2
{% for wipes in range(5) %}
G1 Y360 X324
G1 Y357 X326
G1 Y360 X326
G1 Y357 X328
G1 Y360 X330
G1 Y357 X332
G1 Y360 X334
G1 Y357 X336
G1 Y360 X338
G1 Y357 X340
{% endfor %}
M400
M117 Clean Finish
M107
G91
G1 Z10 F300
G90
G28 Z
[gcode_macro CLEAN_NOZZLE_MANUAL]
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
STATUS_LEVELING
QUAD_GANTRY_LEVEL
STATUS_HOMING
G28 Z
G90
G1 X348 Y348 Z10 F9000
STATUS_HEATING
M117 Nozzle heating...
M109 S200
G91
G90
M106 S127
STATUS_CLEANING
M117 Clean nozzle
G1 X315 Y360 F9000
G1 Z0.2 F300
G1 X352 F4500
{% for wipes in range(5) %}
G1 Y360 X324
G1 Y360 X345
{% endfor %}
G1 Z5
G1 Z0.2
{% for wipes in range(5) %}
G1 Y360 X324
G1 Y357 X326
G1 Y360 X326
G1 Y357 X328
G1 Y360 X330
G1 Y357 X332
G1 Y360 X334
G1 Y357 X336
G1 Y360 X338
G1 Y357 X340
{% endfor %}
M400
M117 Clean Finish
M107
G91
G1 Z10 F300
G90
G28 Z
STATUS_READY
TURN_OFF_HEATERS
M84
[gcode_macro QUAD_GANTRY_LEVEL_MANUAL]
gcode:
STATUS_HOMING
G28
STATUS_LEVELING
QUAD_GANTRY_LEVEL
G28 Z
STATUS_READY
[gcode_macro QUAD_GANTRY_LEVEL_MANUAL]
gcode:
STATUS_HOMING
G28
STATUS_LEVELING
QUAD_GANTRY_LEVEL
G28 Z
STATUS_READY
[gcode_macro STATUS_HEATING]
gcode:
; nothing
[gcode_macro STATUS_HOMING]
gcode:
; nothing
[gcode_macro STATUS_LEVELING]
gcode:
; nothing
[gcode_macro STATUS_MESHING]
gcode:
; nothing
[gcode_macro STATUS_CLEANING]
gcode:
; nothing
[gcode_macro STATUS_READY]
gcode:
; nothing
[gcode_macro STATUS_PRINTING]
gcode:
; nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment