Skip to content

Commit

Permalink
Merge pull request #64 from moggieuk/sync
Browse files Browse the repository at this point in the history
Consolidation of Gear/Extruder syncing work
  • Loading branch information
moggieuk authored Jun 9, 2023
2 parents 509e859 + adb9836 commit c6431d0
Show file tree
Hide file tree
Showing 8 changed files with 553 additions and 124 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,33 @@ Regardless of loading settings above it is important to accurately set `home_to_
This is much simplier than loading. The toolhead sensor, if installed, will automatically be leveraged as a checkpoint when extracting from the extruder.
`sync_unload_length` controls the mm of synchronized movement at start of bowden unloading. This can make unloading more reliable if the tip is caught in the gears and will act as what Ette refers to as a "hair pulling" step on unload. This is an optional step, set to 0 to disable.

### Synchronized Gear/Extruder motors
The ERCF system now offers the optional feature of coordinating its gear motor with the extruder stepper during printing. This added functionality enhances the filament pulling torque, potentially alleviating friction-related problems. **It is crucial, however, to maintain precise rotational distances for both the primary extruder stepper and the gear stepper. A mismatch in filament transfer speeds between these components could lead to undue stress and filament grinding.**

#### Setting up Print Synchronization
Synchronizion during printing is controlled by 'sync_to_extruder' in `ercf_parameters.cfg`. If set to 1, after a toolchange, the ERCF servo will stay engaged and the gear motor will sync with he extruder for move extrusion and retraction moves

#### Synchronization Workflow
If the `sync_to_extruder` feature is activated, the gear stepper will automatically coordinate with the extruder stepper following a successful tool change. Any ERCF operation that necessitates exclusinve gear stepper movement (like buzzing the gear stepper to verify filament engagement), will automatically disengage the sync. Generally, you don't need to manually manage the coordination/discoordination of the gear stepper — Happy Hare handles the majority of these actions. However, if the printer enters ERCF_PAUSE state (due to a filament jam or runout, for example), synchronization is automatically disengaged and the servo lifted. Upon resuming a print synchronization will automatically be resumed however if you wist to enable it whilst operating the ERCF during a pause use the `ERCF_SYNC_GEAR_MOTOR` command.

The `ERCF_SYNC_GEAR_MOTOR sync={0|1} servo={0|1}` command functions as follows:
- Defaults to `sync=1` and `servo=1`
- If `sync=1` and `servo=1`, it triggers the servo and executes the synchronization
- If `sync=1` and `servo=0`, it performs only the synchronization
- If `sync=0` and `servo=1`, it disengages and lifts the servo
- If `sync=0` and `servo=0`, it only disengages the synchronization

You can still control the gear stepper motor with the `MANUAL_STEPPER` command, however, this will only be effective if the stepper is not currently syncing with the extruder.

#### Other synchonization options
In addition to synchronizing the gear motor to the extruder during print the same mechanism can be used to synchronize during other parts of the loading and unload process. Whilst these might seem like duplicates of previous partial load/unload sync movements they operate slightly more simlified manner. If they are all disabled, Happy Hare will operate as it did previously. If these options are enabled they turn off the former functionality. E.g. If `sync_extruder_load` is enabled it will keep the gear synchronized with the extruder for the entire loading of the extruder.<br>
Note that many run the gear stepper at maximum current to overcome friction. If you are one of those you might want to consider using `sync_gear_current` to reduce the current while it is synced during print to keep the temperature down.

`sync_extruder_load` turns on synchronization of extruder loading
`sync_extruder_unload` turns on synchronization of extruder unloading
`sync_form_tip` turns on syncronization of the stand alone tip forming movement
`sync_gear_current` the percentage reduction of gear stepper while it is synchronized with extruder

### Clog/runout detection
ERCF can use its encoder to detect filament runout or clog conditions. This functionality is enabled with the `enable_clog_detection` in ercf_parameters.cfg. It works by monitoring how much filament the extruder is pushing and comparing it that measured by the encoder. If the extruder ever gets ahead by more that the calibrated `clog_detection_length` the runout/clog detection logic is triggered. If it is determined to be a clog, the printer will pause in the usual manner and require `ERCF_UNLOCK` & `RESUME` to continue. If a runout and endless spool is enabled the tool with be remaped and printing will automatically continue.

Expand Down Expand Up @@ -486,6 +513,7 @@ Good luck and hopefully a little less *enraged* printing. You can find me on di
| ERCF_ENABLE | Enable ERCF and reset state after disable | None |
| ERCF_DISABLE | Disable all ERCF functionality | None |
| ERCF_ENCODER | Explicitly enable or disable the encoder. Note that the encoder state is set automatically so this will only be sticky until next tool change | ENABLE=\[0\|1\] |
| ERCF_SYNC_GEAR_MOTOR | Explicitly override the synchronization of extruder and gear motors. Note that synchronization is set automatically so this will only be sticky until the next tool change | SYNC=\[0\|1\] Turn gear/extruder synchronization on/off (default 1) <br>SERVO=\[0\|1\] If 1 (the default) servo will engage if SYNC=1 or disengage if SYNC=0 otherwise servo position will not change |
<br>

## Servo and motor control
Expand Down
27 changes: 25 additions & 2 deletions doc/UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Important: Happy Hare upgrade notes
In v1.2.0, v1.2.1 and v1.2.2 changes were made that altered the contents of the `ercf_hardware.cfg` and `ercf_parameters.cfg` as well as adding new klipper extra modules. When upgrading to these versions it is necessary to also run:
In v1.2.0, v1.2.1, v1.2.2 and v1.3.0 changes were made that altered the contents of the `ercf_hardware.cfg` and `ercf_parameters.cfg` as well as adding new klipper extra modules. When upgrading to these versions it is necessary to also run:

> cd /home/pi/ERCF-Software-V3<br>
> ./install.sh
Optionally if you have multiple instances of Klipper running on a single rpi or have Klipper installed in a non-standard location you will also need to add `-c` and `-k` flags like so:

> ./install.sh -k <klipper_home_dir> -c <klipper_config_dir>
This will attempt to update your `.cfg` files for you and install the additional klipper modules. If successful nothing else is required. However if you are curious or run into problems, keep reading...

## For a full explanation of the changes read below:
Expand Down Expand Up @@ -43,7 +47,7 @@ Also the following option was added to `ercf_parameters.cfg`:


### v1.2.2
Introduced a custom encoder driver that removes the need to `[duplicate_pin_override]` and the `[filament_motion_sensor]` in `ercf_hardware.cfg`. Which this change comes that ability to dynamically change clog detection during print and to choose a new automatic selection which iwill tune detection length automatically!
Introduced a custom encoder driver that removes the need to `[duplicate_pin_override]` and the `[filament_motion_sensor]` in `ercf_hardware.cfg`. Which this change comes that ability to dynamically change clog detection during print and to choose a new automatic selection which will tune detection length automatically!

This release requires a few changes:

Expand Down Expand Up @@ -75,3 +79,22 @@ And note that `enable_clog_detection` now has 3 possible values (2 is recommende

enable_clog_detection: 2 # 0 = disable, 1 = static length clog detection, 2 = automatic length clog detection


### v1.3.0
Introduced synchronized gear/extruder movement during print! This is implemented through a stepper controller that can both act as a MANUAL_STEPPER and as an extruder. The `[manual_stepper gear_stepper]` section of `ercf_hardware.cfg` needs to be changed to `[manual_extruder_stepper gear_stepper]`. Also, the `extruder: extruder` line under `[ercf_encoder]` can be deleted. It is harmless but the extruder name is now centrally set in `ercf_parameters.cfg`

In addition several new parameters are added to control gear/extruder syncing as well as the ability to any extruder for use with ERCF.

extruder_name: extruder # Name of the toolhead extruder that ERCF is using

# EXPERIMENTAL: New synchronized gear/extruder movement!
# If enabled for loading or unloading extruder this will override 'sync_load_length' and 'sync_unload_length'
# If you normally run with maxed out gear stepper current consider reducing it with 'sync_gear_current'
#
sync_to_extruder: 0 # Gear motor is synchronized to extruder during print
sync_load_extruder: 0 # Full extruder load leveraging motor synchronization
sync_unload_extruder: 0 # Full extruder unload (except stand alone tip forming) leveraging motor synchronization
sync_form_tip: 0 # Standalone tip formation (initial part of unload) also leveraging motor synchronization
#
sync_gear_current: 100 # Percentage of gear_stepper current (10%-100%) to use when syncing with extruder during print

6 changes: 2 additions & 4 deletions ercf_hardware.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serial: {serial}
# Please adapt these values to the motor you are using
# Example : for NEMA17 motors, you'll usually set the stealthchop_threshold to 0
# and use higher current
[tmc2209 manual_stepper gear_stepper]
[tmc2209 manual_extruder_stepper gear_stepper]
uart_pin: {gear_uart_pin}
uart_address: 0
interpolate: True
Expand All @@ -35,7 +35,7 @@ hold_current: 0.1 # Can be small
sense_resistor: 0.110
stealthchop_threshold: 0 # 999999 to enable stealthChop

[manual_stepper gear_stepper]
[manual_extruder_stepper gear_stepper]
step_pin: {gear_step_pin}
dir_pin: {gear_dir_pin}
enable_pin: {gear_enable_pin}
Expand Down Expand Up @@ -96,7 +96,6 @@ maximum_pulse_width: 0.00215
[ercf_encoder ercf_encoder]
encoder_pin: ^{encoder_pin} # EASY-BRD: ^ercf:PA6, Flytech ERB: ^ercf:gpio22
encoder_resolution: 1.339226 # Set AFTER 'rotation_distance' is tuned for gear stepper (see manual)
extruder: extruder # The extruder to track with for runout/clog detection

# These are advanced but settings for Automatic clog detection mode. Make sure you understand or ask questions on Discord
desired_headroom: 8.0 # The runout headroom that ERCF will attempt to maintain (closest ERCF comes to triggering runout)
Expand All @@ -113,4 +112,3 @@ flowrate_samples: 10 # How many "movements" on the encoder to measure over for
#switch_pin: {toolhead_sensor_pin}
## ERCF Toolhead sensor END


43 changes: 30 additions & 13 deletions ercf_parameters.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ num_moves: 1 # Number of moves to make when loading or unloading bowden
# end of bowden position. This is useful is you suspect slippage on high speed loading (but requires accurate encoder)
# If disabled, the gear stepper will be solely responsible for filament positioning in bowden (requires minimal friction)
apply_bowden_correction: 0
#
# When using 'apply_bowden_correction' how close in mm the correction moves will attempt to get to target (unload mirrors this value)
load_bowden_tolerance: 10.0


# Filament homing, loading and unloading controls -------------------------------------------------------------------------
Expand All @@ -47,16 +50,17 @@ toolhead_homing_step: 1.0 # Step size to use when homing to the toolhead sensor
extruder_homing_max: 50 # Maximum distance to advance in order to attempt to home the extruder
extruder_homing_step: 2.0 # Step size to use when homing to the extruder with collision detection (default 2)
#
# For accurate homing and to avoid grinding, tune the gear stepper current reduction (currently TMC2209 only)
# To ensure no skipping during fast tip-forming moves, tune the extruder current increase (currently TMC2209 only)
extruder_homing_current: 40 # Percentage of gear_stepper current (20%-100%) to use when homing to extruder homing (100 to disable)
# For accurate homing and to avoid grinding, tune the gear stepper current reduction (Requires TMC driver)
extruder_homing_current: 40 # Percentage of gear_stepper current (10%-100%) to use when homing to extruder homing (100 to disable)
#
# To ensure no skipping during fast tip-forming moves, tune the extruder current increase (Requires TMC driver)
extruder_form_tip_current: 100 # Percentage of extruder current (100%-150%) to use when forming tip (100 to disable)
#
# How far (mm) to run gear_stepper and extruder together in sync on load and unload. This will make loading and unloading
# more reliable and will act as a "hair pulling" step on unload. These settings are optional - use 0 to disable
# Non zero value for 'sync_load_length' will synchronize the whole homing distance if toolhead sensor is installed
sync_load_length: 10 # mm of synchronized extruder loading at entry to extruder
sync_unload_length: 10 # mm of synchronized movement at start of bowden unloading
sync_load_length: 10 # mm of synchronized extruder loading at entry to extruder PAUL DELETE boolean instead
sync_unload_length: 10 # mm of synchronized movement at start of bowden unloading PAUL DELETE boolean instead
#
# This is the distance of the final filament load from the homing point to the nozzle
# If homing to toolhead sensor this will be the distance from the toolhead sensor to the nozzle
Expand All @@ -74,6 +78,18 @@ home_position_to_nozzle: 72 # E.g. Revo Voron with CW2 extruder using extruder
# unload distance from extruder. An accurate setting can reduce tip noise/grinding on exit from extruder)
#extruder_to_nozzle: 72 # E.g. Revo Voron with CW2 extruder using extruder homing
#sensor_to_nozzle: 62 # E.g. Revo Voron with CW2 extruder using toolhead sensor homing
#
# EXPERIMENTAL: New synchronized gear/extruder movement!
# If enabled for loading or unloading extruder this will override 'sync_load_length' and 'sync_unload_length'
# If you normally run with maxed out gear stepper current consider reducing it with `sync_gear_current`
#
sync_to_extruder: 0 # Gear motor is synchronized to extruder during print
sync_load_extruder: 0 # Full extruder load leverages motor synchronization
sync_unload_extruder: 0 # Full extruder unload (except stand alone tip forming) leverages motor synchronization
sync_form_tip: 0 # Standalone tip formation (initial part of unload) also leverages motor sychronization
#
sync_gear_current: 100 # Percentage of gear_stepper current (10%-100%) to use when syncing with extruder during print



# Selector gate positions -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -102,7 +118,7 @@ colorselector: 2.3, 23.3, 44.3, 70.4, 91.4, 112.4, 138.5, 159.5, 180.5
# The default mapping for tool to gate. If not specified or commented out the mapping will default to Tx = Gate #x
# This must be the same length at the number of gates.
# Note that this will be overriden by a saved value in ercf_vars.cfg. ERCF_RESET_TTG_MAP will revert to these default values
tool_to_gate_map: 0, 1, 2, 3, 4, 5, 6, 7, 8
#tool_to_gate_map: 0, 1, 2, 3, 4, 5, 6, 7, 8


# Options and Features ----------------------------------------------------------------------------------------------------
Expand All @@ -129,25 +145,26 @@ enable_endless_spool: {endless_spool} # 0 = disable endless spool, 1 = enable
# 2 = additionally restore persisted tool-to-gate mapping
# 3 = additionally restore persisted gate status (filament availability, material and color)
# 4 = additionally restore persisted tool, gate and filament position!
persistence_level: 2
persistence_level: 3


# Advanced: Configurable, but fairly fixed values ------------------------------------------------------------------------
timeout_pause: 72000 # Time out used by the ERCF_PAUSE
disable_heater: 600 # Delay after which the hotend heater is disabled in the ERCF_PAUSE state
extruder_name: extruder # Name of the toolhead extruder that ERCF is using
timeout_pause: 72000 # Time out in seconds used by the ERCF_PAUSE
disable_heater: 600 # Delay in seconds after which the hotend heater is disabled in the ERCF_PAUSE state
min_temp_extruder: 200 # Used to ensure we can move the extruder and form tips
unload_buffer: 40 # Amount to reduce the fast unload so that accurate encoder unload has room to operate
load_encoder_retries: 2 # Number of times ERCF will attempt to grab the filament on initial load (max 5)
parking_distance: 23.0 # Controls how close to the gate washer the filament is parked (distance from encoder, range=12-30)
ignore_extruder_load_error: 0 # Whether the detection of successful extruder load is considered an error or warning (ignored)
load_bowden_tolerance: 10.0 # When using 'apply_bowden_correction' this is how close the correction moves will attempt to get on load
delay_servo_release: 2.0 # Delay release on servo by (mm) when not using synchronous load
servo_duration: 0.2 # Duration of PWM burst sent to servo (automatically turns off)
homing_method: 0 # EXPERIMENTAL. Filament homing method if not using toolhead sensor. 0=collision detection, 1=stallguard
z_hop_height: 5 # Height in mm of z_hop move on pause or runout to avoid blob on print
z_hop_speed: 15 # mm/s Speed of z_hop move
sync_load_speed: 10 # mm/s speed of synchronized extruder load moves
sync_unload_speed: 10 # mm/s speed of synchronized extruder unload moves
nozzle_load_speed: 10 # mm/s speed of load move inside extruder from homing position to meltzone
nozzle_unload_speed: 10 # mm/s speed of unload moves inside of extruder (very initial move from meltzone is 50% of this)
servo_duration: 0.2 # Duration of PWM burst sent to servo (automatically turns off)
nozzle_load_speed: 12 # mm/s speed of load move inside extruder from homing position to meltzone
nozzle_unload_speed: 12 # mm/s speed of unload moves inside of extruder (very initial move from meltzone is 50% of this)


Loading

0 comments on commit c6431d0

Please sign in to comment.