purge bucket

This commit is contained in:
Kyle Brown 2022-04-05 22:53:04 -07:00
parent 641d53608a
commit 7ac952dbd2
5 changed files with 246 additions and 22 deletions

View file

@ -7,8 +7,10 @@ gcode:
G28
M190 S{bedtemp} ; set & wait for bed temp
GO_TO_BUCKET
M109 S{hotendtemp} ; set & wait for hotend temp
G28 Z ; final z homing
CLEAN_NOZZLE
#G28 Z ; final z homing
[gcode_macro PRINT_END]
gcode:
@ -23,11 +25,12 @@ gcode:
G90
TURN_OFF_HEATERS
#Park_toolhead
G91
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
G91
GO_TO_BUCKET
#G91
#G1 Z{Z}
#G90
#G1 X{X} Y{Y} F6000
#G91
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
@ -45,9 +48,9 @@ gcode:
rename_existing: BASE_PAUSE
gcode:
#Edit this#
{% set X = 230 %}
{% set Y = 230 %}
{% set Z = 10 %}
{% set X = 290 %}
{% set Y = 331 %}
{% set Z = 2 %}
###########
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
@ -61,9 +64,7 @@ gcode:
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
CLEAN_NOZZLE
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
@ -87,3 +88,27 @@ gcode:
gcode:
TURN_OFF_HEATERS
DISABLE_MOTORS
[gcode_macro GO_TO_BUCKET]
gcode:
#Edit this#
{% set X = 290 %}
{% set Y = 331 %}
{% set Z = 2 %}
###########
SAVE_GCODE_STATE NAME=AT_BUCKET
G91
#G1 E-1.7 F2100
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
G91
[gcode_macro RETURN_FROM_BUCKET]
gcode:
G91
#G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=AT_BUCKET MOVE=1

13
pico.cfg Normal file
View file

@ -0,0 +1,13 @@
[mcu pico]
serial: /dev/serial/by-id/usb-Klipper_rp2040_E660583883417B39-if00
[adxl345]
spi_bus: spi0a
cs_pin: pico:gpio1
[resonance_tester]
accel_chip: adxl345
probe_points:
155,155,20 # an example

View file

@ -1,3 +1,4 @@
#[include pico.cfg]
[include basic_macros.cfg]
[include timelapse.cfg]
[include kiauh_macros.cfg]
@ -7,6 +8,7 @@
[include sherpa_mini.cfg]
[include fans.cfg]
[include calibration_macros.cfg]
[include purge_bucket.cfg]
[pause_resume]
[display_status]
@ -15,13 +17,12 @@ path: ~/gcode_files
[printer]
kinematics: corexy
max_velocity: 2000
max_accel: 5000
#max_accel: 50000
#max_accel_to_decel: 100000
max_velocity: 1000
max_accel: 15000
max_accel_to_decel: 15000
max_z_velocity: 30
max_z_accel: 1500
square_corner_velocity: 20
max_z_accel: 500
square_corner_velocity: 8
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_2B0016000B50534E4E313120-if00
@ -45,8 +46,16 @@ screw2: 2,310
screw3: 322,310
[safe_z_home]
home_xy_position: 335, 331
speed: 100.0
home_xy_position: 315, 331
speed: 500.0
z_hop: 5
z_hop_speed: 15.0
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [input_shaper]
#*# shaper_type_x = mzv
#*# shaper_freq_x = 70.4
#*# shaper_type_y = mzv
#*# shaper_freq_y = 63.2

177
purge_bucket.cfg Normal file
View file

@ -0,0 +1,177 @@
[gcode_macro clean_nozzle]
# If you are putting your purge bucket at the rear left of the bed as per default installation, enable True on your location_bucket_rear
# variable. If you want to put your purge bucket elsewhere (perhaps the front), then set it to False. See diagrams and description
# further below on how to set your XY position.
variable_location_bucket_rear: True
# If you want the purging routine in your bucket enabled, set to True (and vice versa).
variable_enable_purge: True
# These parameters define your filament purging. The retract variable is used to retract right after purging to prevent unnecessary
# oozing. Some filament are particularly oozy and may continue to ooze out of the nozzle for a second or two after retracting. The
# ooze dwell variable makes allowance for this. Update as necessary. If you decided to not enable purge, you can ignore this section.
variable_purge_len: 10 ; Amount of filament, in mm, to purge.
variable_purge_spd: 150 ; Speed, in mm/min, of the purge.
variable_purge_temp_min: 220 ; Minimum nozzle temperature to permit a purge. Otherwise, purge will not occur.
variable_purge_ret: 1 ; Retract length, in mm, after purging to prevent slight oozing. Adjust as necessary.
variable_ooze_dwell: 1 ; Dwell/wait time, in seconds, after purging and retracting.
# Adjust this so that your nozzle scrubs within the brush. Currently defaulted to be a lot higher for safety. Be careful not to go too low!
variable_brush_top: 8
# These parameters define your scrubbing, travel speeds, safe z clearance and how many times you want to wipe. Update as necessary. Wipe
# direction is randomized based off whether the left or right bucket is randomly selected in the purge & scrubbing routine.
variable_clearance_z: 10 ; When traveling, but not cleaning, the clearance along the z-axis between nozzle and brush.
variable_wipe_qty: 3 ; Number of complete (A complete wipe: left, right, left OR right, left, right) wipes.
variable_prep_spd_xy: 3000 ; Travel (not cleaning) speed along x and y-axis in mm/min.
variable_prep_spd_z: 1500 ; Travel (not cleaning) speed along z axis in mm/min.
variable_wipe_spd_xy: 5000 ; Nozzle wipe speed in mm/min.
# These parameters define the size of the brush. Update as necessary. A visual reference is provided below. Note that orientation of
# parameters remain the same whether bucket is at rear or front.
#
# ← brush_width →
# _________________ ↑
# | | ↑ If you chose location_bucket_rear = True, Y position is acquired
# brush_start (x) | | brush_depth from your stepper_y position_max. Adjust your brush physically in
# |_________________| ↓ Y so that the nozzle scrubs within the brush.
# (y) ↓
# brush_front
# __________________________________________________________
# PRINTER FRONT
#
#
## For V1.8, you may need to measure where your brush is on the x axis and input manually into any of the variable_brush_start uncommented.
variable_brush_start: 235
# This value is defaulted from brush location in CAD (rear left). Change if your brush width is different.
variable_brush_width: 34
## These are only used if location_bucket_rear is False. You specify a custom location in y axis for your brush - see diagram above. ##
variable_brush_front: 325
variable_brush_depth: 243
# These parameters define the size of your purge bucket. Update as necessary. If you decided to not enable purge, you can ignore
# this section. A visual reference is provided below. Note that orientation of parameters remain the same whether bucket is at rear
# or front.
#
# bucket_gap
# ← ---- →
# __________________________________________
# | | | |
# | | | |
# bucket_start (x) | |______| |
# | | | |
# | | | |
# |_________________|. . . |_________________|
# ← ------------- → ← ------------- →
# bucket_left_width bucket_right_width
# _______________________________________________________________________________________
# PRINTER FRONT
#
## For V2.4 250mm build, uncomment below
variable_bucket_left_width: 42
# These values are defaulted from bucket geometry in CAD (rear left location). Change only if you're using a custom bucket.
variable_bucket_right_width: 40
variable_bucket_gap: 22
# For V1.8, you may need to measure where your bucket start is and input into bucket_start. Otherwise, a value of 0 is for a default
# installation of purge bucket at rear left.
variable_bucket_start: 212
###############################################################################################################################################
###############################################################################################################################################
### From here on, unless you know what you're doing, it's recommended not to change anything. Feel free to peruse the code and reach out to me
### (edwardyeeks#6042) on Discord if you spot any problems!
###############################################################################################################################################
###############################################################################################################################################
# Placeholder. The variable will later be set to contain, at random, a number representing the left or right bucket.
variable_bucket_pos: 1
gcode:
# First, check if the axes are homed.
{% if "xyz" in printer.toolhead.homed_axes %}
## Save the gcode state in this macro instance.
SAVE_GCODE_STATE NAME=clean_nozzle
## Set to absolute positioning.
G90
## Grab max position of Y-axis from config to use in setting a fixed y position for location_bucket_rear = True.
{% set Ry = printer.configfile.config["stepper_y"]["position_max"]|float %}
## Check if user enabled purge option or not.
{% if enable_purge %}
### Randomly select left or right bin for purge. 0 = left, 1 = right
SET_GCODE_VARIABLE MACRO=clean_nozzle VARIABLE=bucket_pos VALUE={(range(2) | random)}
### Raise Z for travel.
G1 Z{brush_top + clearance_z} F{prep_spd_z}
### Check if user chose to use rear location.
{% if location_bucket_rear %}
G1 Y{Ry} F{prep_spd_xy}
{% else %}
G1 Y{brush_front + (brush_depth / 2)} F{prep_spd_xy}
{% endif %}
### Position for purge. Randomly selects middle of left or right bucket. It references from the middle of the left bucket.
G1 X{bucket_start + (bucket_left_width / (2 - bucket_pos)) + (bucket_pos * bucket_gap) + (bucket_pos * (bucket_right_width / 2))}
### Perform purge if the temp is up to min temp. If not, it will skip and continue executing rest of macro. Small retract after
### purging to minimize any persistent oozing at 5x purge_spd. G4 dwell is in milliseconds, hence * 1000 in formula.
{% if printer.extruder.temperature >= purge_temp_min %}
M83 ; relative mode
G1 E{purge_len} F{purge_spd}
G1 E-{purge_ret} F{purge_spd * 5}
G4 P{ooze_dwell * 1000}
G92 E0 ; reset extruder
{% endif %}
{% endif %}
## Position for wipe. Either left or right of brush based off bucket_pos to avoid unnecessary travel.
G1 Z{brush_top + clearance_z} F{prep_spd_z}
G1 X{brush_start + (brush_width * bucket_pos)} F{prep_spd_xy}
## Check if user chose to use rear location.
{% if location_bucket_rear %}
G1 Y{Ry}
{% else %}
G1 Y{brush_front + (brush_depth / 2)}
{% endif %}
## Move nozzle down into brush.
G1 Z{brush_top} F{prep_spd_z}
## Perform wipe. Wipe direction based off bucket_pos for cool random scrubby routine.
{% for wipes in range(1, (wipe_qty + 1)) %}
G1 X{brush_start + (brush_width * (1 - bucket_pos))} F{wipe_spd_xy}
G1 X{brush_start + (brush_width * bucket_pos)} F{wipe_spd_xy}
{% endfor %}
## Clear from area.
M117 Cleaned!
G1 Z{brush_top + clearance_z} F{prep_spd_z}
#G1 X{bucket_left_width / 4} F{prep_spd_xy}
## Restore the gcode state to how it was before the macro.
RESTORE_GCODE_STATE NAME=clean_nozzle MOVE=1
{% else %}
## raise error will stop any macros that clean_nozzle is referenced in from proceeding for safety.
{ action_raise_error("Please home your axes!") }
M117 Please home first!
{% endif %}

View file

@ -37,8 +37,8 @@ enable_pin: !PG5
microsteps: 16
rotation_distance: 4
endstop_pin: PG10
position_endstop: -1.55
position_min: -3
position_endstop: -1
position_min: -1
position_max: 400
full_steps_per_rotation: 200
homing_retract_dist: 5.0