infrastructure/klipper/macros.cfg

134 lines
4.4 KiB
INI

[gcode_macro PID_EXTRUDER]
gcode:
PID_CALIBRATE HEATER=extruder TARGET=210
SAVE_CONFIG
[gcode_macro PID_BED]
gcode:
PID_CALIBRATE HEATER=heater_bed TARGET=60
SAVE_CONFIG
[gcode_macro FILAMENT_LOAD]
gcode:
{% set load = params.L|default(100)|float * 0.5 %}
{% set extruder_temp = params.T|default(210)|float %}
SAVE_GCODE_STATE NAME=FILAMENT_LOAD_STATE
LOW_TEMP_CHECK T={extruder_temp}
M118 Loading filament
M83 # relative extrusion
G1 E{load} F1500 # extrude fast
G4 P1000 # wait 1 second
G1 E{load} F200 # extrude slow
RESTORE_GCODE_STATE NAME=FILAMENT_LOAD_STATE
BEEP
[gcode_macro FILAMENT_UNLOAD]
gcode:
{% set unload = params.U|default(100)|float %}
{% set extruder_temp = params.T|default(200)|float %}
SAVE_GCODE_STATE NAME=FILAMENT_UNLOAD_STATE
LOW_TEMP_CHECK T={extruder_temp}
M118 Unloading filament
M83 # relative extrusion
G1 E2 F200 # extrude a little
G1 E-10 F200 # retract a little
G1 E-{unload} F1500 # retract a lot
RESTORE_GCODE_STATE NAME=FILAMENT_UNLOAD_STATE
[gcode_macro LOW_TEMP_CHECK]
gcode:
{% set extruder_temp = params.T|default(200)|float %}
{% if printer.extruder.target > extruder_temp %} # if there is a setpoint for extruder
{% set extruder_temp = printer.extruder.target %}
{% endif %}
{% if printer.extruder.temperature < extruder_temp %} # heat to the target
M118 Heating to {extruder_temp}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={extruder_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp}
{% endif %}
[gcode_macro BEEP]
gcode:
{% set duration = params.P|default(100)|float %}
SET_PIN PIN=beeper VALUE=1
G4 P{duration}
SET_PIN PIN=beeper VALUE=0
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
M140 S{BED_TEMP}
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
# Wait for bed to reach temperature
M190 S{BED_TEMP}
# Set and wait for nozzle to reach temperature
M109 S{EXTRUDER_TEMP}
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
BED_MESH_PROFILE LOAD=default
[gcode_macro END_PRINT]
description: End of printing
variable_machine_depth: 220
gcode:
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 z50 ;Raise Z more
G90 ;Absolute positioning
G1 X0 Y{machine_depth} ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z
BEEP
[gcode_macro PRINT_STOP]
gcode:
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z50 ;Raise Z more
G90 ;Absolute positionning
G1 X0 Y200 ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z50 ;Raise Z more
G90 ;Absolute positionning
G1 X0 Y200 ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z