Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ gcode:
## 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 %}
## Calculate y position of the brush.
{% set Ry = printer.configfile.config["stepper_y"]["position_max"] if location_bucket_rear else brush_front + (brush_depth / 2) |float %}

## Check if user enabled purge option or not.
{% if enable_purge %}
Expand All @@ -170,12 +170,8 @@ gcode:
### 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 on the y position of the brush.
G1 Y{Ry} F{prep_spd_xy}

### 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))}
Expand All @@ -196,12 +192,8 @@ gcode:
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 %}
## Position on the y position of the brush.
G1 Y{Ry}

## Move nozzle down into brush.
G1 Z{brush_top} F{prep_spd_z}
Expand All @@ -215,7 +207,7 @@ gcode:
## Clear from area.
M117 Cleaned!
G1 Z{brush_top + clearance_z} F{prep_spd_z}
G1 X{bucket_start + (bucket_left_width * (1 + (3 * bucket_park)) / 4) + (bucket_park * bucket_gap) + (bucket_park * (bucket_right_width / 2))} F{prep_spd_xy} #bugfix for right side mounted buckets
park_nozzle

## Restore the gcode state to how it was before the macro.
RESTORE_GCODE_STATE NAME=clean_nozzle
Expand All @@ -227,3 +219,17 @@ gcode:
M117 Please home first!

{% endif %}

[gcode_macro park_nozzle]
gcode:
{% set bucket_start = printer["gcode_macro clean_nozzle"].bucket_start %}
{% set bucket_left_width = printer["gcode_macro clean_nozzle"].bucket_left_width %}
{% set bucket_park = printer["gcode_macro clean_nozzle"].bucket_park %}
{% set bucket_gap = printer["gcode_macro clean_nozzle"].bucket_gap %}
{% set bucket_right_width = printer["gcode_macro clean_nozzle"].bucket_right_width %}
{% set location_bucket_rear = printer["gcode_macro clean_nozzle"].location_bucket_rear %}
{% set brush_front = printer["gcode_macro clean_nozzle"].brush_front %}
{% set brush_depth = printer["gcode_macro clean_nozzle"].brush_depth %}
{% set Ry = printer.configfile.config["stepper_y"]["position_max"] if location_bucket_rear else brush_front + (brush_depth / 2) |float %}
{% set prep_spd_xy = printer["gcode_macro clean_nozzle"].prep_spd_xy %}
G1 X{bucket_start + (bucket_left_width * (1 + (3 * bucket_park)) / 4) + (bucket_park * bucket_gap) + (bucket_park * (bucket_right_width / 2))} Y{Ry} F{prep_spd_xy} #bugfix for right side mounted buckets