Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Tool_Loaded T/F to query status #187

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,67 @@ gcode:
### Fixed
- Fixed erroring out if a buffer in not configured

## [2024-12-02]

### Added

- Buffer_Ram_Sensor
- Enabling the buffer to be used as a ram sensor for loading and unloading filament
- see Buffer_Ram_Sensor doc for more information

### Changed

- Adjusted load and unload to account for ram sensor
- Adjusted Prep to account for ram sensor

## [2024-12-03]

### Added

- The `install-afc.sh` script will now query the printer upon exit to see if it is actively printing. If it is not
printing, it will restart the `klipper` service.
## [2024-12-04]

### Fixed
- Fixed issue with Turtleneck buffer pins not being assigned correctly when prompted during install
- Fixed issue with LEDs not showing the right color when error happened during PREP
- Changed error message when AFC.vars.unit lane showed loaded but AFC.vars.tool file didn't match
- Added logic so that user could change trsync value. To set value add the following into `[AFC]` section in AFC.cfg file:
`trsync_update: True`
Optional:
`trsync_timeout: 0.05`
`TRSYNC_SINGLE_MCU_TIMEOUT: 0.5`

## [2024-12-07]

### Updated
- When BT_TOOL_UNLOAD is used, spoolman active spool is set to None
- When spool is ejected from Box Turtle spoolman spool is removed from variables
- Activated espooler when user calls LANE_MOVE

### Fixed
- Fixed places where gcode was not referencing AFC and would cause crashes


## [2024-12-09]

### Added
- Added logic to pause print when filament goes past prep sensor. Verify that PAUSE macro move's toolhead off print when it's called.
=======
## [2024-12-08]

### Added
- When updating the AFC software, the `install-afc.sh` script will now remove any instances of `[gcode_macro T#]` found in the `AFC_Macros.cfg`
file as the code now generates them automatically.

## [2024-12-09]

### Added
- **New Command: `CALIBRATE_AFC`**
Allows calibration of the hub position and Bowden length in the Automated Filament Changer (AFC) system.
Supports calibration for a specific lane or all lanes (`LANES` parameter).
Provides options for distance and tolerance during calibration:
- `DISTANCE=<distance>`: Optional distance parameter for lane movement during calibration (default is 25mm).
- `TOLERANCE=<tolerance>`: Optional tolerance for fine-tuning adjustments during calibration (default is 5mm).
- Bowden Calibration: Added functionality to calibrate Bowden length for individual lanes using the `BOWDEN` parameter.

84 changes: 78 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Additionally, review the following files for any changes that may be required:
1) `~/printer_data/config/AFC/AFC.cfg`
2) `~/printer_data/config/AFC/AFC_Macro_Vars.cfg`

Review information in [mandatory configuration changes](README.md#mandatory-configuration-changes-all) section

## Installation & Configuration (Manual)

To manually install and configure the plugin, you can use the following commands:
Expand Down Expand Up @@ -121,12 +123,39 @@ Prior to operation, the following checks / updates **MUST** be made to your syst

1) Update the following values in the `~/printer_data/config/AFC/AFC.cfg` file:

- tool_stn
- tool_stn_unload
- afc_bowden_length

2) If you are using any of the built-in macros, the variables in the `~/printer_data/config/AFC/AFC_Macro_Vars.cfg` file
must also be modified to match your configuration for your system.
- tool_stn: This value is the length from your toolhead sensor to nozzle
- tool_stn_unload: This value is the amount to unload from extruder when doing a filament change.
- afc_bowden_length: This value is the length from your hub to your toolhead sensor

2) Verify that `pin_tool_start` is set to the correct pin for your toolhead sensor. If you are using an existing filament sensor as your toolhead sensor make sure you comment out the filament sensor section in your `printer.cfg` file.

3) If you are using any of the built-in macros, the variables in the `~/printer_data/config/AFC/AFC_Macro_Vars.cfg` file
must also be modified to match your configuration for your system.

Required variables to verify and update if necessary for the following default macros
- tool_cut:
- variable_retract_length
- variable_cut_direction
- variable_pin_loc_xy
- variable_pin_park_dist
- variable_cut_move_dist
- park:
- variable_park_loc_xy
- poop:
- variable_purge_loc_xy
- kick:
- variable_kick_start_loc
- variable_kick_direction
- wipe
- variable_brush_loc
- variable_y_brush
- form_tip
Variables to update for tip forming are in `~/printer_data/config/AFC/AFC.cfg`
- cooling_tube_position
- cooling_tube_length

4) If you would like to use your own macro instead of the provided macros, make sure to update the command with your custom macro in `~/printer_data/config/AFC/AFC.cfg`
ex. If using custom park macro, change `park_cmd` from `AFC_PARK` to your macro name

**Failure to update these values can result in damage to your system**

Expand All @@ -140,12 +169,55 @@ led_buffer_trailing: 0,1,0,0
led_buffer_disable: 0,0,0,0.25
```

If using a hub that is not located in the box turtle the following value needs to be updated for each stepper
- dist_hub: This value the the length between the lanes extruder and the hub, this does not have to be exact and is better to figure the length and then minus about 40mm

If using snappy hub cutter update the following values:
- cut: change to True
- cut_dist: update to the value that you would like to cut off the end, this may take some tuning to get right

## Calibration

The function `CALIBRATE_AFC` can be called in the console to calibrate distances.

_distances will be calibrated to have ~1 short move after the move distance_

### Definitions

- `dist_hub` for each lane is the distance from the load switch at the extruder to the hub
- `afc_bowden_length` is the distance from the hub to the toolhead sensor

### Usage

`CALIBRATE_AFC LANES=<lane> DISTANCE=<distance> TOLERANCE=<tolerance> BOWDEN=<lane>`

_`DISTANCE` and `TOLERANCE` are optional. default distance 25mm, default tolerance 5mm_

- To calibrate all lanes and the bowden length all at once:
- `CALIBRATE_AFC LANES=all BOWDEN=<lane>` input which lane to be used to check `afc_bowden_length`
- To calibrate individual lanes
- `CALIBRATE_AFC LANES=<lane>` input the lane you would like to calibrate
- To calibrate just the bowden length:
- `CALIBRATE_AFC BOWDEN=<lane>` input which lane to be used to check `afc_bowden_length`

__Values must be updated in AFC_Hardware.cfg after calibration__

## Troubleshooting

Debug information about the respooler system can be found by visiting the following URL in your browser:

`{ip address}/printer/objects/query?AFC`

### LEDs not displaying correct color
If your leds are not displaying the correct color update the following value under your `AFC_led` section in `~/printer_data/config/AFC/AFC_hardware.cfg` file.
- color_order: change to match the color order for you leds. Different color orders are: RGB, RGBW, GRB, GRBW

### Filament pulling past extruder during unloads
During unloads if your filament retracts too much and goes past the lanes extruder then decrease your `afc_bowden_length` value in `~/printer_data/config/AFC/AFC.cfg` file

### Timer too close (TTC) error
If you keep getting TTC errors start by adding the following to `AFC/AFC.cfg` file under `[AFC]` section
- `trsync_update: True`

## Removing Plugin

Expand Down
8 changes: 4 additions & 4 deletions config/AFC.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ short_move_dis: 10 # Move distance for failsafe moves. Default is 1
#------- Pause/Resume ---------------------------------------------------------------
#--=================================================================================-
z_hop: 5 # Height to move up before and after a tool change completes
resume_speed: 350 # Speed mm/s of resume move. Set to 0 to use gcode speed
resume_z_speed: 100 # Speed mm/s of resume move in Z. Set to 0 to use gcode speed
resume_speed: 120 # Speed mm/s of resume move. Set to 0 to use gcode speed
resume_z_speed: 30 # Speed mm/s of resume move in Z. Set to 0 to use gcode speed


#--=================================================================================-
#------- Spoolman -------------------------------------------------------------------
#--=================================================================================-
# spoolman_ip: http://spoolman.local # Spoolman IP address.
# spoolman_port: 7912 # Spoolman port.
# spoolman_ip: localhost # Spoolman IP address.
# spoolman_port: 7912 # Spoolman port.


#--=================================================================================-
Expand Down
73 changes: 40 additions & 33 deletions config/AFC_Macro_Vars.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ gcode: # Leave Empty
# Set this to match your AFC_stepper base naming in AFC_Hardware.cfg
variable_stepper_name : 'leg' # [AFC_stepper leg1] [AFC_stepper leg2]...

variable_travel_speed : 350 # Speed mm/s
variable_z_travel_speed : 100 # Speed mm/s
variable_verbose : 1 # Console Output for macros
# 0 - None
# 1 - Limited
# 2 - All
variable_travel_speed : 120 # Speed mm/s
variable_z_travel_speed : 30 # Speed mm/s
variable_accel : 2000 # Move accel for all macro moves
variable_verbose : 1 # Console Output for macros
# 0 - None
# 1 - Limited
# 2 - All


#--=================================================================================-
Expand All @@ -25,6 +26,28 @@ variable_verbose : 1 # Console Output for macros
description: Toolhead tip cutting macro configuration variables
gcode: # Leave empty

# This should be the position of the toolhead where the cutter arm just
# lightly touches the depressor pin
variable_pin_loc_xy : -1, -1 # x,y coordinates of depressor pin

# Accel during cut. This will overwrite the global accel for this macro. Set to 0 to use global accel
variable_cut_accel : 0

# Direction to make the cut move (left, right, front, back)
variable_cut_direction : "left"

# This distance is used to move toolhead to cut filament
# and to create a small saftely distance that aids in generating momentum
variable_pin_park_dist : 6.0 # Distance in mm

# Position of the toolhead when the cutter is fully compressed.
# Distnace the toolhead needs to travel to compress the cutter arm.
# To calculate this distance start at the pin_loc_xy position and move
# your toolhead till the cutter arm is completely compressed. Take 0.5mm off this distance
# as a buffer.
# Ex pin_loc_x : 9, 310 fully compressed at 0, 310 set cut_move_dist to 8.5
variable_cut_move_dist : 8.5 # Distance in mm

# Speed related settings for tip cutting
# Note that if the cut speed is too fast, the steppers can lose steps.
# Therefore, for a cut:
Expand All @@ -33,9 +56,9 @@ gcode: # Leave empty
# - We then make a slow move for the actual cut to happen
variable_cut_fast_move_speed : 32 # Speed mm/s
variable_cut_slow_move_speed : 10 # Speed mm/s
variable_evacuate_speed : 150 # Speed mm/s
variable_evacuate_speed : 150 # Speed mm/s
variable_cut_dwell_time : 50 # Time to dwell at the cut point in ms
variable_cut_fast_move_fraction : 0.85 # Fraction of the move that uses fast move 0.0 - 1.0
variable_cut_fast_move_fraction : 0.85 # Fraction of the move that uses fast move 0.0 - 1.0
variable_extruder_move_speed : 25 # Speed mm/s for all extruder movement

# If the toolhead returns to initial position after the cut is complete.
Expand All @@ -49,28 +72,9 @@ variable_retract_length : 20
# This can help prevent cloggin of some toolheads by doing a quick tip from to reduce stringing
variable_quick_tip_forming : False

# Direction to make the cut move (left, right, front, back)
variable_cut_direction : "left"

# Number of times to run the cut movement
variable_cut_count : 2

# This should be the position of the toolhead where the cutter arm just
# lightly touches the depressor pin
variable_pin_loc_xy : 9, 310 # x,y coordinates of depressor pin

# This distance is used to move toolhead to cut filament
# and to create a small saftely distance that aids in generating momentum
variable_pin_park_dist : 6.0 # Distance in mm

# Position of the toolhead when the cutter is fully compressed.
# Distnace the toolhead needs to travel to compress the cutter arm.
# To calculate this distance start at the pin_loc_xy position and move
# your toolhead till the cutter arm is completely compressed. Take 0.5mm off this distance
# as a buffer.
# Ex pin_loc_x : 9, 310 fully compressed at 0, 310 set cut_move_dist to 8.5
variable_cut_move_dist : 8.5 # Distance in mm

# Retract length and speed after the cut so that the cutter can go back
# into its origin position
variable_rip_length : 1.0 # Distance in mm to retract to aid lever decompression (>= 0)
Expand All @@ -95,7 +99,7 @@ variable_safe_margin_xy : 30, 30 # Approx toolhead width +5mm, heig
description: Poop macro configuration variables
gcode: # Leave empty
# (x,y) Location of where to purge
variable_purge_loc_xy : 297, 290
variable_purge_loc_xy : -1, -1

# Speed, in mm/s, of the purge.
variable_purge_spd : 6.5
Expand Down Expand Up @@ -152,12 +156,15 @@ variable_purge_length_minimum : 60.999
description: Kick macro configuration variables
gcode: # Leave empty
# Location to move before kick
variable_kick_start_loc : 250, 300, 10
variable_kick_start_loc : -1, -1, 10

variable_kick_z : 1.5 # Height to drop to for kick move

variable_kick_speed : 150 # Speed of kick movement

# Accel of kick moves. This will overwrite the global accel for this macro. Set to 0 to use global accel
variable_kick_accel : 0

# Direction to make the kick move (left, right, front, back)
variable_kick_direction : "right"

Expand All @@ -173,13 +180,13 @@ variable_z_after_kick : 10 # Height of z after kick move
description: Brush macro configuration variables
gcode: # Leave empty
# Position of the center of the brush (Set z to -1 if you dont want a z move)
variable_brush_loc : 217, 310, -1
variable_brush_loc : -1, -1, -1

# Speed of cleaning moves when brushing
variable_brush_clean_speed : 150

# Accel of cleaning moves when brushing
variable_brush_clean_accel : 1500
# Accel of cleaning moves when brushing. This will overwrite the global accel for this macro. Set to 0 to use global accel
variable_brush_clean_accel : 0

# Total width in mm of the brush in the X direction
variable_brush_width : 30
Expand All @@ -200,7 +207,7 @@ variable_brush_count : 4 # Number of passes to make on the brush.
description: Park macro configuration variables
gcode: # Leave empty
# Position to park the toolhead
variable_park_loc_xy : 270, 310
variable_park_loc_xy : -1, -1

# Height to raise Z when moving to park. Leave 0 to disable
# If you want z_hop during toolchanges please set the value in the AFC.cfg
Expand Down
34 changes: 1 addition & 33 deletions config/macros/AFC_macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,4 @@ gcode:
[gcode_macro BT_PREP]
description: Run the AFC PREP sequence
gcode:
PREP

[gcode_macro T0]
description: Change to tool 0
gcode:
{% set stepper = printer['gcode_macro _AFC_GLOBAL_VARS'].stepper_name|string %}
{% set ln = stepper ~ "1" %}

CHANGE_TOOL LANE={ln}

[gcode_macro T1]
description: Change to tool 1
gcode:
{% set stepper = printer['gcode_macro _AFC_GLOBAL_VARS'].stepper_name|string %}
{% set ln = stepper ~ "2" %}

CHANGE_TOOL LANE={ln}

[gcode_macro T2]
description: Change to tool 2
gcode:
{% set stepper = printer['gcode_macro _AFC_GLOBAL_VARS'].stepper_name|string %}
{% set ln = stepper ~ "3" %}

CHANGE_TOOL LANE={ln}

[gcode_macro T3]
description: Change to tool 3
gcode:
{% set stepper = printer['gcode_macro _AFC_GLOBAL_VARS'].stepper_name|string %}
{% set ln = stepper ~ "4" %}

CHANGE_TOOL LANE={ln}
PREP
Loading
Loading