Disclaimer: This is an independent resource site.
Not affiliated with the Voron project or its development team.
Firmware retraction is one of Klipper's most powerful yet underutilized features for Voron printers. Instead of each slicer profile managing its own retraction settings, firmware retraction centralizes retraction logic in your printer config, giving you per-filament control, cleaner g-code, and consistent results across any slicer.
---
## What is Firmware Retraction?
In traditional (slicer) retraction, the slicer calculates retraction distance and speed during slicing and embeds the commands (`G1 E-0.8 F1200`) directly in the g-code. After every retraction, the slicer also inserts the corresponding un-retract (`G1 E0.8 F600`).
**Firmware retraction** replaces all of this with a single `M207` configuration command. The slicer only needs to emit `G10` (retract) and `G11` (un-retract), and the firmware handles the rest:
- Retraction distance
- Retraction speed
- Un-retraction speed
- Additional Z-lift (if configured)
- Any temperature-specific compensation
**Benefits for Voron printers:**
| Feature | Benefit |
|---------|---------|
| Consistent behavior | Same retraction across OrcaSlicer, PrusaSlicer, Superslicer, Cura |
| Per-filament profiles | Switch retraction by changing filament, not slicer profile |
| Cleaner g-code | No inline retraction math, smaller files |
| Z-lift integration | Add Z-hop on retract without modifying slicer g-code |
| Pressure advance synergy | Works naturally with Klipper's PA system |
---
## Enabling Firmware Retraction in Klipper
Klipper implements firmware retraction via the `[firmware_retraction]` config section:
[firmware_retraction]
retract_length: 0.8
retract_speed: 35
unretract_extra_len: 0.0
unretract_speed: 30
That's it. Once this section is in your `printer.cfg`, Klipper responds to `G10` (retract) and `G11` (un-retract) using these parameters.
---
## Full Configuration Reference
### Available Parameters
| Parameter | Default | Range | Description |
|-----------|---------|-------|-------------|
| `retract_length` | 0 | 0–10 mm | Distance filament retracts on G10 |
| `retract_speed` | 20 | 1–200 mm/s | Speed of retraction |
| `unretract_extra_len` | 0 | -5–5 mm | Extra filament pushed on un-retract (compensate for ooze) |
| `unretract_speed` | 20 | 1–200 mm/s | Speed of un-retraction |
| `z_lift` | 0 | 0–10 mm | Z-axis lift height on retract |
| `z_speed` | 5 | 1–100 mm/s | Speed of Z-lift (Voron fast Z available) |
### Full Example with Z-Lift
[firmware_retraction]
retract_length: 0.8
retract_speed: 40
unretract_extra_len: 0.0
unretract_speed: 30
z_lift: 0.3
z_speed: 15
When G10 is called, the printer will:
1. Lift Z by 0.3mm at 15mm/s
2. Retract filament 0.8mm at 40mm/s
On G11:
1. Un-retract 0.8mm at 30mm/s
2. Lower Z back to original position
---
## Slicer Configuration for Firmware Retraction
**The key rule: set slicer retraction to 0 and use firmware retraction.**
### OrcaSlicer / Bambu Studio
1. Go to **Printer Settings > Extruder**
2. Set **Retraction Length** to **0**
3. Set **Retraction Speed** to **0** (or any value — it's ignored)
4. Enable **Use firmware retraction** checkbox
5. (Optional) Enable **Z hop when retract** only if you want slicer Z-hop too
### PrusaSlicer / SuperSlicer
1. Go to **Printer Settings > Extruder 1**
2. Set **Retraction Length** to **0**
3. Set **Lift Z** to **0** (if using firmware Z-lift)
4. Check **Use firmware retraction**
5. In **Print Settings > Extruder 1**, uncheck any retraction settings
### Cura
1. Go to **Extensions > Post Processing > Modify G-Code**
2. Add a script: **Replace** or **Search and Replace**
3. Replace `G1 E... F...` retraction commands with `G10` / `G11`
4. Or better, use a custom start g-code that sets `M207` and disable Cura retraction
---
## G-Code Commands Reference
### G10 — Firmware Retract
Initiates retraction using current firmware settings. No parameters needed (unless overriding):
G10 ; Retract using configured values
### G11 — Firmware Un-Retract
Initiates un-retraction:
G11 ; Un-retract using configured values
### M207 — Set Firmware Retraction Parameters
Dynamically change retraction at runtime (equivalent to `SET_RETRACTION`):
M207 S0.8 R35 F2000 Z0.3 ; Set retract params
Parameters:
- `S` — retract length (mm)
- `R` — retract speed (mm/min, note: mm/min!)
- `F` — un-retract speed (mm/min)
- `Z` — Z-lift height (mm)
**Important:** M207 speeds are in **mm/min**, while config parameters are mm/s. Divide by 60 to convert.
### M208 — Set Firmware Un-Retraction
Sets un-retraction with extra length:
M208 S0.05 F1800 ; Set un-retract extra length and speed
Parameters:
- `S` — extra length on un-retract (mm)
- `F` — un-retract speed (mm/min)
### M200 — Set Filament Diameter
Not retraction-specific, but relevant for proper extrusion math:
M200 D1.75 ; Set filament diameter
### SET_RETRACTION — Klipper Native Command
Modern alternative to M207/M208, supports more features:
SET_RETRACTION RETRACT_LENGTH=0.8 RETRACT_SPEED=40 UNRETRACT_SPEED=30 Z_LIFT=0.3
### GET_RETRACTION — Query Current Settings
GET_RETRACTION
Returns current firmware retraction parameters.
---
## Firmware vs Slicer Retraction — Detailed Comparison
| Aspect | Slicer Retraction | Firmware Retraction |
|--------|------------------|-------------------|
| Control location | Slicer profile | printer.cfg |
| Change filament? | Edit and re-slice | Change profile at print start |
| Z-hop integration | Slicer must calculate | Firmware handles automatically |
| G-code size | Larger (inline E values) | Smaller (G10/G11 only) |
| Testing | Must re-slice to test | Change at runtime with M207 |
| Multi-extruder | Per-extruder in config | Per-tool in g-code |
| Ooze compensation | Manual in slicer | unretract_extra_len parameter |
**When to use firmware retraction:**
- You have a direct drive extruder (Clockwork, Galileo, Sherpa, Stealthburner, etc.)
- You switch filaments frequently
- You want one slicer profile for all materials
- You use pressure advance (they work well together)
**When slicer retraction might be better:**
- You're troubleshooting a specific g-code path
- You need different retractions within the same print (uncommon)
- You're using an exotic filament that needs very unique retraction behavior
---
## Per-Filament Retraction Profiles
Combine firmware retraction with `save_variables` for instant profile switching:
[firmware_retraction]
retract_length: 0.8
retract_speed: 40
unretract_extra_len: 0.0
unretract_speed: 30
[gcode_macro SET_FILAMENT_RETRACTION]
description: Apply retraction profile for filament type
gcode:
{% set filament = params.FILAMENT|default("PLA") %}
{% set fl = printer.save_variables.variables["retract_" ~ filament] | default(0.8) %}
{% set fs = printer.save_variables.variables["retract_speed_" ~ filament] | default(40) %}
{% set us = printer.save_variables.variables["unretract_speed_" ~ filament] | default(30) %}
SET_RETRACTION RETRACT_LENGTH={fl} RETRACT_SPEED={fs} UNRETRACT_SPEED={us}
M117 Retraction set for {filament}
[gcode_macro SAVE_FILAMENT_RETRACTION]
description: Save current retraction settings for filament type
gcode:
{% set filament = params.FILAMENT|default("PLA") %}
{% set fl = params.LENGTH|default(0.8) %}
{% set fs = params.RETRACT_SPEED|default(40) %}
{% set us = params.UNRETRACT_SPEED|default(30) %}
SAVE_VARIABLE VARIABLE=retract_{filament} VALUE={fl}
SAVE_VARIABLE VARIABLE=retract_speed_{filament} VALUE={fs}
SAVE_VARIABLE VARIABLE=unretract_speed_{filament} VALUE={us}
SET_RETRACTION RETRACT_LENGTH={fl} RETRACT_SPEED={fs} UNRETRACT_SPEED={us}
M117 Retraction saved for {filament}
**Usage:**
SAVE_FILAMENT_RETRACTION FILAMENT=PLA LENGTH=0.6 RETRACT_SPEED=40 UNRETRACT_SPEED=30
SET_FILAMENT_RETRACTION FILAMENT=ABS
---
## Calibrating Firmware Retraction
### The Retraction Tower Method
1. **Slice a 20mm cube** with 5mm height segments, firmware retraction enabled
2. **Add M207/M208 changes** at each segment in the slicer's post-processing
3. **Print and observe** — look for stringing at each segment
**Better approach — Klipper-based calibration:**
Use the `TUNING_TOWER` macro with retraction changes:
[gcode_macro RETRACTION_CALIBRATE]
description: Run a retraction calibration tower
gcode:
SAVE_GCODE_STATE NAME=retraction_cal_state
M117 Retraction calibration starting...
{% for i in range(5) %}
{% set rl = 0.4 + (i * 0.2) %} # 0.4, 0.6, 0.8, 1.0, 1.2
SET_RETRACTION RETRACT_LENGTH={rl}
M117 Segment {i+1}: {rl}mm retract
G4 P600000 # Wait 10 min (print segment)
{% endfor %}
RESTORE_GCODE_STATE NAME=retraction_cal_state
### Recommended Starting Values for Voron Extruders
| Extruder | Retract Length (PLA) | Retract Length (ABS) | Retract Speed | Unretract Speed |
|----------|---------------------|---------------------|---------------|-----------------|
| Clockwork 1 | 0.6–0.8 mm | 0.4–0.6 mm | 35–40 mm/s | 25–30 mm/s |
| Clockwork 2 (BMG) | 0.6–0.8 mm | 0.4–0.6 mm | 35–40 mm/s | 25–30 mm/s |
| Galileo / G2SA | 0.4–0.6 mm | 0.3–0.5 mm | 40–50 mm/s | 30–40 mm/s |
| Sherpa Mini | 0.6–0.8 mm | 0.4–0.6 mm | 35–45 mm/s | 25–35 mm/s |
| Orbiter 1.5/2.0 | 0.4–0.6 mm | 0.3–0.5 mm | 40–50 mm/s | 30–40 mm/s |
| Stealthburner CW2 | 0.6–0.8 mm | 0.4–0.6 mm | 35–40 mm/s | 25–30 mm/s |
| Revo CW2 | 0.4–0.6 mm | 0.3–0.5 mm | 40–45 mm/s | 30–35 mm/s |
**Note:** BMG-geared extruders (most Voron extruders) need less retraction than direct-drive because the gear ratio amplifies retraction distance.
---
## Firmware Retraction and Pressure Advance
Firmware retraction and pressure advance (PA) work together but interact:
### How They Interact
1. **PA on retract:** Klipper applies PA in reverse during retraction — it slightly over-retracts to relieve nozzle pressure
2. **PA on un-retract:** PA adds a small extra extrusion at the start of un-retract to re-pressurize the nozzle
3. **Result:** With PA enabled, you may need slightly less firmware retraction length
### Best Practices
# Start with PA calibrated first, then tune retraction
[firmware_retraction]
retract_length: 0.6 # May need 0.1–0.2mm less with PA enabled
retract_speed: 40
unretract_extra_len: 0.0
unretract_speed: 30
[extruder]
pressure_advance: 0.045 # Calibrate this first!
**Calibration order:**
1. Calibrate pressure advance (use the built-in tuning tower)
2. Tune firmware retraction
3. Fine-tune together on a retraction tower
### Warning: Don't Double-Compensate
If you set `unretract_extra_len` to compensate for PA, you'll over-extrude on un-retracts. In general, leave `unretract_extra_len` at 0.0 when using PA.
---
## Advanced Techniques
### Dynamic Retraction Based on Feature Type
Use conditional macros to vary retraction:
[gcode_macro DYNAMIC_RETRACT]
description: Adjust retraction based on travel length
gcode:
{% set travel = params.TRAVEL|default(10) %}
{% if travel < 10 %}
SET_RETRACTION RETRACT_LENGTH=0.0 # Tiny moves, no retract
{% elif travel < 50 %}
SET_RETRACTION RETRACT_LENGTH=0.4 # Short moves
{% else %}
SET_RETRACTION RETRACT_LENGTH=0.8 # Long moves
{% endif %}
### Temperature-Compensated Retraction
As nozzle temperature increases, filament oozes more. Compensate:
[gcode_macro TEMP_RETRACT]
description: Adjust retraction based on nozzle temp
gcode:
{% set temp = printer.extruder.temperature %}
{% if temp >= 260 %}
SET_RETRACTION RETRACT_LENGTH=1.0 # High-temp filament
{% elif temp >= 230 %}
SET_RETRACTION RETRACT_LENGTH=0.8 # ABS/Nylon range
{% else %}
SET_RETRACTION RETRACT_LENGTH=0.6 # PLA range
{% endif %}
### Z-Lift Only on Certain Moves
Some slicers can't handle fine-grained Z-hop control. Use firmware Z-lift and conditionally enable it:
[gcode_macro ENABLE_Z_LIFT]
description: Enable firmware Z-lift
gcode:
SET_RETRACTION Z_LIFT=0.3
M117 Z-lift enabled
[gcode_macro DISABLE_Z_LIFT]
description: Disable firmware Z-lift (for bridging/overhangs)
gcode:
SET_RETRACTION Z_LIFT=0.0
M117 Z-lift disabled
---
## Troubleshooting Common Issues
### Strings Between Parts
**Cause:** Retraction too short or speed too slow.
**Fix:**
- Increase `retract_length` by 0.1mm increments
- Increase `retract_speed` to 40–50 mm/s
- Check filament is dry (wet filament strings regardless of retraction)
### Blobs at Layer Start
**Cause:** Too much retraction or un-retract extra length.
**Fix:**
- Decrease `retract_length`
- Set `unretract_extra_len` to 0 or negative
- Ensure pressure advance is calibrated
### Clogged Nozzle / Under-Extrusion
**Cause:** Excessive retraction pulling molten filament into the cold zone.
**Fix:**
- Decrease `retract_length` (common for direct-drive — try 0.3mm!)
- Decrease `retract_speed` (too fast pulls filament up too far)
- Increase nozzle temperature slightly
### Z-Lift Leaving Marks
**Cause:** Z-lift speed too slow, causing ooze on vertical moves.
**Fix:**
- Increase `z_speed` to 15–20 mm/s
- Decrease `z_lift` to 0.2mm or less
- Ensure Z motors can handle the speed (Voron Z is capable)
### G10/G11 Not Working
**Cause:** Slicer not configured for firmware retraction, or missing `[firmware_retraction]` section.
**Fix:**
1. Verify `[firmware_retraction]` is in `printer.cfg`
2. Send `RESTART` to reload config
3. In console, send `GET_RETRACTION` to verify settings
4. Check slicer's "use firmware retraction" checkbox
---
## Complete Setup Example
### printer.cfg Section
[firmware_retraction]
retract_length: 0.8
retract_speed: 40
unretract_extra_len: 0.0
unretract_speed: 30
### Slicer Profile (OrcaSlicer)
- Printer Settings > Extruder:
- Retraction Length: 0
- Retraction Speed: 0
- Use Firmware Retraction: Enabled
- Printer Settings > Basic Info:
- G-code flavor: Klipper
### PRINT_START Macro Integration
[gcode_macro PRINT_START]
gcode:
# ... homing, heating ...
# Set retraction based on filament
{% set ftype = params.FILAMENT_TYPE|default("PLA") %}
{% if ftype == "ABS" %}
SET_RETRACTION RETRACT_LENGTH=0.6
{% elif ftype == "PETG" %}
SET_RETRACTION RETRACT_LENGTH=0.7
{% else %}
SET_RETRACTION RETRACT_LENGTH=0.8
{% endif %}
# Apply saved PA for this filament
{% set pa = printer.save_variables.variables["pa_" ~ ftype] | default(0.045) %}
SET_PRESSURE_ADVANCE ADVANCE={pa}
M117 Starting print with {ftype}
# ... rest of start gcode ...
---
## Summary
Firmware retraction with `M207`/`M208` (or `SET_RETRACTION`) simplifies your Voron's retraction setup while giving you more control: