Files
Sovol-SV06-firmware/macros.cfg
2022-12-31 03:45:40 -05:00

174 lines
8.5 KiB
INI

[pause_resume]
[display_status]
[gcode_macro PURGE_LINE]
# https://github.com/JoeCat1207/V0.1-Purge-line-SuperSlicer/blob/main/Purgeline.txt
gcode:
G0 Y0 X40 F4000 ; go to tongue of print bed
G1 Z0.2 F500.0 ; move bed to nozzle
G92 E0.0 ; reset extruder
G1 E1.40 F500 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT
G1 X80 E8.0 F500.0 ; intro line 1
G1 Y0.3 ; move in a little
G1 X40 E8.0 F500.0 ; second line
G92 E0.0 ; reset extruder
G1 Z2.0 ; move nozzle to prevent scratch
# [gcode_macro CANCEL_PRINT]
# description: Cancel the actual running print
# rename_existing: CANCEL_PRINT_BASE
# gcode:
# TURN_OFF_HEATERS
# M107 ; turn off fan
# CANCEL_PRINT_BASE
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
CLEAR_PAUSE
SDCARD_RESET_FILE
PRINT_END
BASE_CANCEL_PRINT
[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customize for your slicer of choice
#gcode:
# G28 ; home all axes
# G1 Z20 F3000 ; move nozzle away from bed
gcode:
# Parameters
{% set bedtemp = params.BED|int %}
{% set hotendtemp = params.HOTEND|int %}
{% set chambertemp = params.CHAMBER|default(0)|int %}
G28 X Y
# <insert your routines here>
M190 S{bedtemp} ; set & wait for bed temp
# TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={chambertemp} ; wait for chamber temp
# <insert your routines here>
M109 S{hotendtemp} ; set & wait for hotend temp
# <insert your routines here>
G28 Z ; final z homing
G1 Z20 F3000 ; move nozzle away from bed
# SKEW_PROFILE LOAD=my_skew_profile
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customize for your slicer of choice
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-1.40 F400 ; retract filament
G91 ; relative positioning
# SET_SKEW CLEAR=1 ; clear skew_profile
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F1000 ; move nozzle up ;3600
G0 X{x_safe} Y{y_safe} F7200 ; move nozzle to remove stringing ;20000 ;9000
TURN_OFF_HEATERS
M107 ; turn off fan
G90 ; absolute positioning
G0 X60 Y{max_y} F3600 ; park nozzle at rear
[gcode_macro LOAD_FILAMENT]
gcode:
M83 ; set extruder to relative
G1 E30 F300 ; load
G1 E15 F150 ; prime nozzle with filament
M82 ; set extruder to absolute
[gcode_macro UNLOAD_FILAMENT]
gcode:
M83 ; set extruder to relative
G1 E10 F300 ; extrude a little to soften tip
G1 E-40 F1800 ; retract some, but not too much or it will jam
M82 ; set extruder to absolute
[gcode_macro M600]
gcode:
#LCDRGB R=0 G=1 B=0 ; Turn LCD green
PAUSE ; Pause
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
# Parameters
{% set z = params.Z|default(10)|int %} ; z hop amount
{% if printer['pause_resume'].is_paused|int == 0 %}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro
# SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0 ; disable filament sensor
SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume
BASE_PAUSE ; pause print
{% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max
G91 ; relative positioning
G1 Z{z} F900 ; raise Z up by z hop amount
{% else %}
{ action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
{% endif %}
G90 ; absolute positioning
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
M104 S0 ; turn off hotend
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
{% endif %}
[gcode_macro RESUME]
rename_existing: BASE_RESUME
variable_zhop: 0
variable_etemp: 0
gcode:
# Parameters
{% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm)
{% if printer['pause_resume'].is_paused|int == 1 %}
# SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1 ; enable filament sensor
#INITIAL_RGB ; reset LCD color
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
{% if etemp > 0 %}
M109 S{etemp|int} ; wait for hotend to heat back up
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
G91 ; relative positioning
M83 ; relative extruder positioning
{% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down
{% else %}
G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position
BASE_RESUME ; resume print
{% endif %}
[gcode_macro _CG28]
# Conditional homing
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}