forked from jschuh/klipper-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_end.cfg
91 lines (86 loc) · 2.98 KB
/
start_end.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro print_start]
description: Inserted by slicer at start of print.
Usage: PRINT_START BED=<temp> EXTRUDER=<temp> [CHAMBER=<temp>]
[MESH_MIN=<x,y>] [MESH_MAX=<x,y>] [LAYERS=<num>]
gcode:
CLEAR_PAUSE
{% set BED = params.BED|default(params.BED_TEMP)|float %}
{% set EXTRUDER = params.EXTRUDER|default(params.EXTRUDER_TEMP)|float %}
{% set CHAMBER = params.CHAMBER|default(0)|float
if "chamber" in printer.heaters.available_heaters else 0.0 %}
{% set km = printer["gcode_macro _km_globals"] %}
_INIT_LAYER_GCODE LAYERS="{params.LAYERS|default(0)|int}"
{% if CHAMBER > 0.0 %}
M141 S{CHAMBER}
{% endif %}
# Start bed heating
M140 S{BED}
{% if km.start_level_bed_at_temp %}
# If we're going to run a bed level we heat the extruder only part way to
# avoid oozing all over the bed while probing.
M104 S{(km.start_extruder_preheat_scale * EXTRUDER)|round(0,'ceil')|int}
{% else %}
M104 S{EXTRUDER}
{% endif %}
# home all axes
G28
G90
PARK
{% if BED > 0.0 %}
# Overshoot the target a bit.
M190 S{(BED + km.start_bed_heat_overshoot,
printer.configfile.settings.heater_bed.max_temp)|min}
G4 P{km.start_bed_heat_delay / 2}
M190 R{BED} # Settle down after the overshoot.
G4 P{km.start_bed_heat_delay / 2}
{% endif %}
{% if km.start_level_bed_at_temp %}
M104 S{EXTRUDER} # set the final extruder target temperature
G28 Z # Re-home only the Z axis now that the bed has stabilized.
BED_MESH_CALIBRATE MESH_MIN={params.MESH_MIN|default("0,0")
} MESH_MAX={params.MESH_MAX|default("0,0")}
PARK
{% endif %}
{% if CHAMBER > 0.0 %}
M191 S{CHAMBER}
{% endif %}
# Wait for extruder to reach temperature
M109 S{EXTRUDER}
# apply Z offset for bed surface (just in case it was reset).
_APPLY_BED_SURFACE_OFFSET
[gcode_macro print_end]
description: Inserted by slicer at end of print.
Usage: PRINT_END
gcode:
M400
G92 E0
G1 E-5.0 F3600
{% set km = printer["gcode_macro _km_globals"] %}
{% set toolhead = printer.toolhead %}
{% set max_x = toolhead.axis_maximum.x %}
{% set max_y = toolhead.axis_maximum.y %}
{% set max_z = toolhead.axis_maximum.z %}
{% set x_safe = (max_x - toolhead.position.x, 5.0)|min %}
{% set y_safe = (max_y - toolhead.position.y, 5.0)|min %}
{% set z_safe = (max_z - toolhead.position.z, 2.0)|min %}
# Wipe if we're not cancelling a paused print.
{% if not printer.pause_resume.is_paused %}
G91
G0 Z{z_safe} F{km.travel_speed_z * 2} ; move nozzle up
G0 X{x_safe} Y{y_safe} F{km.travel_speed_xy} ; remove stringing
{% endif %}
{% if km.start_clear_adjustments_at_end != 0 %}
RESET_HEATER_SCALING
RESET_FAN_SCALING
M220 S100
M221 S100
{% endif %}
_RESET_LAYER_GCODE
_RESET_VELOCITY_LIMITS
TURN_OFF_HEATERS
M107; turn off fan
PARK Y={max_y}
CLEAR_PAUSE