-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnozzle_wipe.cfg
28 lines (25 loc) · 2.11 KB
/
nozzle_wipe.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
## Add CLEAN NOZZLE MACRO to PRINT_START
## CLEAN_NOZZLE LAYER={[layer_num]} CLEAN_LAYERS=10 ;clean nozzle every 10 layers adjust to whatever you want, not adding ClEAN_LAYERS= will default to every layer.
[gcode_macro CLEAN_NOZZLE]
description: Simple X-axis back and forth nozzle wipe performed wipe_count/2 times. Two PARAMETERS are both optional. The LAYER parameter provides the current layer info from your slicer's Layer Change G-code and CLEAN_LAYERS provides the iteration control for how frequently the nozzle procedure is actually performed. Defaults to 1, i.e., every layer. E.g. , CLEAN_NOZZLE LAYER={[layer_num] CLEAN_LAYERS=3 will clean the nozzle every third layer. Omitting the parameters forces the clean to be performed. While wipe_count could be changed to a parameter, once you determine how many wipes are sufficient it's simpler to set its value within the macro and fuhgetaboutit.
gcode:
{% set layer = params.LAYER|default(0)|int %}; active layer number
{% set clean_layers = params.CLEAN_LAYERS|default(1)|int %}; perform clean procedure every X layer
{% if layer%clean_layers == 0 %} #the percent sign performs a modulo math operation, i.e., it calcs the remainder of a division operation
SAVE_GCODE_STATE NAME=clean_nozzle_state
{% set wipe_count = 6|int %} # each count is a wipe in one-direction
{% set y_dir = 0|int %}
{% if printer.toolhead.position.y > (printer.toolhead.axis_maximum.y - 10) %}: # check for potential nozzle movement interference with bed's edge retaining clips
{% set y_dir = -1 %}
{% elif printer.toolhead.position.y < (printer.toolhead.axis_minimum.y + 10) %}
{% set y_dir = 1 %}
{% endif %}
G91
G0 Z5 # avoid potential nozzle drag across existing print
G90
G0 Y{printer.toolhead.position.y|int + 10 * y_dir} # move nozzle away from edge clips
{% for wipe in range(wipe_count) %} # simple X-axis back-and-forth wipe
G0 X{225 + (20 * (loop.index is even))} F5700
{% endfor %}
RESTORE_GCODE_STATE NAME=clean_nozzle_state MOVE=1
{% endif %}