130 lines
3.6 KiB
Nix
130 lines
3.6 KiB
Nix
|
{
|
||
|
"gcode_macro PAUSE" = {
|
||
|
description = "Pause the running print";
|
||
|
rename_existing = "PAUSE_BASE";
|
||
|
variable_extrude = 1.0;
|
||
|
|
||
|
gcode = ''
|
||
|
##### read E from pause macro #####
|
||
|
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
|
||
|
##### set park positon for x and y #####
|
||
|
# default is your max posion from your printer.cfg
|
||
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
|
||
|
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
|
||
|
##### calculate save lift position #####
|
||
|
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
||
|
{% set act_z = printer.toolhead.position.z|float %}
|
||
|
{% if act_z < (max_z - 2.0) %}
|
||
|
{% set z_safe = 2.0 %}
|
||
|
{% else %}
|
||
|
{% set z_safe = max_z - act_z %}
|
||
|
{% endif %}
|
||
|
##### end of definitions #####
|
||
|
PAUSE_BASE
|
||
|
G91
|
||
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
||
|
G1 E-{E} F2100
|
||
|
{% else %}
|
||
|
{action_respond_info("Extruder not hot enough")}
|
||
|
{% endif %}
|
||
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
||
|
G1 Z{z_safe} F900
|
||
|
G90
|
||
|
G1 X{x_park} Y{y_park} F6000
|
||
|
{% else %}
|
||
|
{action_respond_info("Printer not homed")}
|
||
|
{% endif %}
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
"gcode_macro RESUME" = {
|
||
|
description = "Resume a paused print";
|
||
|
rename_existing = "RESUME_BASE";
|
||
|
gcode = ''
|
||
|
##### read E from pause macro #####
|
||
|
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
|
||
|
#### get VELOCITY parameter if specified ####
|
||
|
{% if 'VELOCITY' in params|upper %}
|
||
|
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
|
||
|
{%else %}
|
||
|
{% set get_params = "" %}
|
||
|
{% endif %}
|
||
|
##### end of definitions #####
|
||
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
||
|
G91
|
||
|
G1 E{E} F2100
|
||
|
{% else %}
|
||
|
{action_respond_info("Extruder not hot enough")}
|
||
|
{% endif %}
|
||
|
RESUME_BASE {get_params}
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
"gcode_macro CANCEL_PRINT" = {
|
||
|
description = "Cancel the running print";
|
||
|
rename_existing = "CANCEL_PRINT_BASE";
|
||
|
gcode = ''
|
||
|
TURN_OFF_HEATERS
|
||
|
CLEAR_PAUSE
|
||
|
SDCARD_RESET_FILE
|
||
|
CANCEL_PRINT_BASE
|
||
|
END_PRINT
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
"gcode_macro START_PRINT" = {
|
||
|
description = "Start of print base sequence";
|
||
|
variable_bed_temp = 60;
|
||
|
variable_extruder_temp = 200;
|
||
|
gcode = ''
|
||
|
# Start bed heating
|
||
|
M140 S{bed_temp}
|
||
|
# Reset the G-Code Z offset (adjust Z offset if needed)
|
||
|
SET_GCODE_OFFSET Z=0.0
|
||
|
# Home the printer
|
||
|
G28
|
||
|
# Use absolute coordinates
|
||
|
G90
|
||
|
# Reset extruder distance
|
||
|
G92 E0
|
||
|
# Move the nozzle near the bed
|
||
|
#G1 Z5 F3000
|
||
|
# Move the nozzle very close to the bed
|
||
|
#G1 Z0.15 F300
|
||
|
# Wait for bed to reach temperature
|
||
|
M190 S{bed_temp}
|
||
|
# Set and wait for nozzle to reach temperature
|
||
|
M109 S{extruder_temp}
|
||
|
# Prime the nozzle
|
||
|
G1 X-3 F500 # Move out of print volume
|
||
|
# G1 E4 F500 # Build a bit of pressure
|
||
|
# G1 Y60 E9 F500 # start purge line
|
||
|
# G1 Y100 E12.5 F500 # finish purge line
|
||
|
# Prime the nozzle
|
||
|
G1 Y140 E15 F1500
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
"gcode_macro END_PRINT" = {
|
||
|
description = "End-of-print sequence";
|
||
|
gcode = ''
|
||
|
# Turn off bed, extruder, and fan
|
||
|
M140 S0
|
||
|
M104 S0
|
||
|
M107
|
||
|
# Move nozzle away from print while retracting
|
||
|
G91
|
||
|
G1 X-2 Y-2 E-5 F300
|
||
|
# Raise nozzle by 10mm
|
||
|
G1 Z10 F3000
|
||
|
# Home X axis
|
||
|
G28 X
|
||
|
G90
|
||
|
# Move bed forward
|
||
|
G1 Y180
|
||
|
# Disable X, Y and extruder steppers
|
||
|
M84 X Y E
|
||
|
'';
|
||
|
};
|
||
|
}
|