Skip to content

Commit

Permalink
Firmware retraction: Fix and extend zhop feature (#420)
Browse files Browse the repository at this point in the history
Co-authored-by: Rogerio Goncalves <[email protected]>
  • Loading branch information
fbeauKmi and rogerlz authored Dec 23, 2024
1 parent 4da071f commit 70394db
Show file tree
Hide file tree
Showing 10 changed files with 330 additions and 815 deletions.
5 changes: 5 additions & 0 deletions docs/Config_Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ deprecated. It will be removed in the near future. Use
instead. The `printer[fan object].speed` status will be replaced by
`printer[fan object].value` and `printer[fan object].power`.

20241223: The `CLEAR_RETRACTION` command does not reset parameters to
default config values anymore, a [`RESET_RETRACTION`](./G-Codes.md#reset_retraction)
command was added to achieve this. Automatic resetting behavior on
events was removed.

20240430: The `adc_ignore_limits` parameter in the `[danger_options]`
config section has been renamed to `temp_ignore_limits` and it now
covers all possible temperature sensors.
Expand Down
7 changes: 6 additions & 1 deletion docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,12 @@ allowing per-filament settings and runtime tuning.
# The vertical height by which the nozzle is lifted from the print to
# prevent collisions with the print during travel moves when retracted.
# The minimum value is 0 mm, the default value is 0 mm, which disables
# zhop moves.
# zhop moves. The value will be reduced if the zhop move reaches
# maximum z.
#clear_zhop_on_z_moves: False
# If True, when a change in Z is sent while toolhead is retracted,
# z_hop is cancelled until next retraction. Otherwise,
# `z_hop_height` is applied as an offset to all movements.
```

### [gcode_arcs]
Expand Down
34 changes: 19 additions & 15 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,36 +633,40 @@ the filament unretract move to reduce blobbing at seams (the minimum value is
Z_HOP_HEIGHT determines the vertical height by which the nozzle is lifted from
the print to prevent collisions with the print during travel moves (the
minimum value is 0 mm, the standard value is 0 mm, which disables Z-Hop moves).
If a parameter is set when retracted, the new value will be taken into
account only after G11 or CLEAR_RETRACTION event.
SET_RETRACTION is commonly set as part of slicer per-filament configuration, as
different filaments require different parameter settings. The command can be
issued at runtime.

#### GET_RETRACTION
`GET_RETRACTION`: Queries the current parameters used by the firmware retraction
module as well as the retract state. RETRACT_LENGTH, RETRACT_SPEED,
UNRETRACT_EXTRA_LENGTH, UNRETRACT_SPEED, Z_HOP_HEIGHT and RETRACTED (True, if
retracted) are displayed on the terminal.
UNRETRACT_EXTRA_LENGTH, UNRETRACT_SPEED, Z_HOP_HEIGHT, RETRACT_STATE (True, if
retracted), ZHOP_STATE (True, if zhop offset currently applied) are displayed on
the terminal.

#### CLEAR_RETRACTION
`CLEAR_RETRACTION`: Clears the current retract state without extruder or
motion system movement. All flags related to the retract state are reset to
False and all changes to retraction parameters made via previous SET_RETRACTION
commands are reset to config values.
NOTE: The Module contains a lot of redundancy for safety to prevent undesired
behavior. When printing from virtual SD Card, the printer state is monitored and
retraction state is cleared if a print is started, canceled or finished or if a
virtual SD card file is reset. When printing via GCode streaming (e.g. using
OctoPrint), the retract state is cleared when the steppers are disabled (M84,
False.

NOTE: The zhop state is also reset to False when the steppers are disabled (M84,
typically part of end gcode and standard behavior of OctoPrint if a print is
canceled) or the printer is homed (G28, typically part of start gcode). Hence,
upon ending or canceling a print as well as starting a new print via GCode
streaming or virtual SD card, the printer should always be in unretracted state.
streaming or virtual SD card, the toolhead will not apply `z_hop_height` until
next G11 if filament is retracted.
Nevertheless, it is recommended to add `CLEAR_RETRACTION` to your start and end
gcode to make sure the retract state is reset before and after each print. If a
print is finished or canceled while retracted and the retract state is not
cleared, either via `CLEAR_RETRACTION` without filament or motion system
movement or G11, the nozzle will stay above the requested z coordinate by the
set z_hop_height.
gcode to make sure the retract state is reset before and after each print.

#### RESET_RETRACTION
`RESET_RETRACTION`: All changes to retraction parameters made via previous
SET_RETRACTION commands are reset to config values.

NOTE: It is recommended to add `RESET_RETRACTION` to your start and end gcode
(with a possible override in your filament start gcode to set filament-specific
overrides of firmware retraction defaults via `SET_RETRACTION`).

### [force_move]

Expand Down
1 change: 1 addition & 0 deletions docs/Status_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ The following information is available in the
config file if a `SET_RETRACTION` command altered them. Additional information
available is as follows.
- `retract_state`: Returns 'True' if filament is retracted.
- `zhop_state`: Returns 'True' if a zhop is currently applied.

## gcode

Expand Down
Loading

0 comments on commit 70394db

Please sign in to comment.