Unified Firmware – Firmware Retraction

How does Firmware Retraction work? #

Slicer-based retraction works by specifying each individual move the extruder makes for each retraction. Similar to the way all of the other motors move, each retraction is specified by “G1” Gcode commands for movement of a certain distance at a certain speed. Essentially, each retraction is “written out” completely.

Firmware Retraction works by enabling specific Gcode commands to retract (G10) and unretract/recover (G11) on command based on the printer’s firmware settings. Instead of the slicer specifying each and every extruder movement, it instead issues a single command to retract and the printer uses its saved settings to do so. Then after the hot-end moves to its next location, the slicer sends a command to unretract/recover so it can print again.

See this informational page from Marlin Firmware’s site for additional information about how this works.

Why would I want to enable Firmware Retraction? #

The ability to adjust retraction settings on-the-fly may save a print job or print quality in case of emergency. For example, print quality issues such as stringing, blobbing, and oozing can sometimes be directly tied to retraction settings. Firmware Retraction allows you to react to your print quality as soon as you begin to see issues… and that can mean the difference between spaghetti and success.

Firmware Retraction is also great for print farm use. Because retraction is set on a per-printer basis rather than in the slicer, you can reuse Gcode files among all of your printers without needing individual profiles for each printer and filament. This can save significant amounts of time if you run identical print jobs on multiple printers by cutting down on the time it takes to slice the models.

Enabling Firmware Retraction in Unified Firmware #

Note: TH3D does NOT provide technical support or assistance with the installation and use of this feature. This guide is intended for advanced printer users and is provided for informational purposes ONLY. Modify these files and settings at your own risk.

Firmware Retraction (called FWRETRACT in Marlin and Unified Firmware) is available within the configuration_adv.h file. Open the configuration_adv.h file and use the “Find” or “Search” feature to search for the phrase “fwretract” or “FWRETRACT”. (In VSCode, go to Edit > Find, or use the hotkeys CTRL+F or ⌘+F for the Find function). This should take you to the settings list we need:

Use the Find or Search function to find the “FWRETRACT” section

To enable this section, remove the slashes “//” from the line that says “#define FWRETRACT”. Adjust the settings as you see fit, or leave them at the defaults if you want to change them later through the printer’s LCD.

Using Firmware Retraction #

LCD Settings #

Once enabled, you should have a new menu available within the printer’s LCD. Go to the Configuration menu and you should see a new menu called “Retract”. Within the Retract menu are options to enable/disable Firmware Retraction, adjust the distances and speeds (“V” for “velocity”), and enable Z-hop and set its distance.

Settings include:

  • Auto-Retract – Enable or disable the ability to override slicer retractions (called Automatic Firmware Retraction or AFR). See the Slicer Settings section below for more information. Recommended value “Off”.
  • Retract mm – total retraction and unretraction distance. Typical starting values are:
    • Bowden-style, PTFE-lined hot-ends may start at 6mm
    • Bowden-style, all-metal hot-ends may start at 3mm (less than 4mm recommended for most all-metal hot-ends to prevent clogging)
    • Direct-drive setups may start at 1mm
  • Retract V – Retraction velocity (speed). Typical starting value is 40-45mm/s.
  • Hop mm – When set to zero, Z-Hop is disabled. When set to a positive value, Z-Hop is enabled and will “hop” the specified distance on each retraction.
  • Unretract mm – When set to a positive value, this distance will be added to the “retract mm” distance when recovering (meaning it extrudes extra filament after the retraction). When set to a negative value, this distance is subtracted from the “retract mm” distance when recovering from a retraction (meaning less filament is pushed back into the hot-end than was retracted). When set to the default value of zero, no length is added or removed from the “retract mm” distance (meaning retractions and recoveries are the same length).
  • Unretract V – Speed the filament is pushed back into the hot-end. We recommend that this setting matches the Retract V setting from earlier in most cases.

Gcode References #

Retractions and recoveries can be manually triggered by using the following Gcode commands:

Firmware Retraction and recovery settings can also be specified via Gcode if desired. See the following pages for more information:

Slicer Settings #

For Firmware Retraction to work properly, your slicer must support it specifically. For example, PrusaSlicer and SuperSlicer have options to enable firmware retraction within the Printer Settings tab:

As of January 2023, Cura does not appear to have a native option for Firmware Retraction. However, users report using a plugin called “Use Printer Settings”. We have not tested this in-house, your mileage may vary.

Firmware Retraction does have the ability to override some slicer retractions in case your slicer does not allow for firmware retractions. This is called “Automatic Firmware Retraction (AFR)” and is available to enable/disable within the firmware, via the printer’s LCD (Auto-Retract setting), and via the M209 command. However, this is not a guaranteed-perfect solution and is not recommended by the Marlin team as noted on Marlin’s Firmware Retraction page. It is recommended to leave AFR disabled in most cases.

Additional Resources #

Was this article helpful?