Skip to content

VFA commands and saved values

Macros and options

Command What it does
VFA_MOTORS The OpenCreator calibration. AXIS=X, Y or XY (default XY), SAVE=1 (default) or 0, GRAPH=1 for graphs.
VFA_MOTORS_GRAPH VFA_MOTORS GRAPH=1; takes AXIS and SAVE too. Before and after calibrating each motor it runs MCLIB_RIPPLE_SWEEP on ripples 1, 2, 4, 6 and 8, then draws vfa_stepper_x.png and vfa_stepper_y.png into vfa/ in the config folder. The menu says about 8 minutes.
VFA_MENU, VFA_GRAPH_MENU The VFA and VFA + Graphs menu entries: a confirmation dialog that runs VFA_MOTORS or VFA_MOTORS_GRAPH. They refuse during a print.

Underneath, each motor gets MCLIB_RIPPLE_CALIBRATE STEPPER=stepper_x (and stepper_y). You can run it yourself after G28, with T0 picked up and the head parked as above:

Parameter Default Meaning
STEPPER required stepper_x or stepper_y
HARMONICS 1,2,4,6,8 Which ripples to calibrate, each 1 to 8
SPEEDS AUTO AUTO picks up to 6 speeds from a quick sweep; or a list of up to 6 motor speeds, each 5 to 150 mm/s
FIT SPEEDS SPEEDS, ONE or AUTO (below)
ROUNDS 2 Refining rounds per speed, 1 to 5
PASSES 2 Moves averaged per measurement, 1 to 10
SAVE 1 0 keeps the result live only, until restart. Otherwise run SAVE_CONFIG to keep it.

Speeds here are mm/s of motor (belt) travel: the test moves run along the diagonal that turns only that motor.

FIT decides how the speeds' results become a table:

  • SPEEDS (default): one value per calibrated speed. On the test printer most ripples did change with speed.
  • ONE: one value per ripple and direction for all speeds.
  • AUTO: one value only where every speed agrees with it and an extra speed the fit didn't use (the middle of the widest gap between the calibrated speeds) confirms it: there it must leave no more than 10% more vibration than the per-speed values. Anything else stays per speed.

The [mclib_ripple] section in printer.vibration.cfg takes these options. The shipped config sets none of them:

Option Default Meaning
accel_chip lis2dw Accelerometer to measure with
center 130, 130 Where the test moves are centered
accel 5000 Acceleration of the test moves (mm/s²), put back afterwards
points 6 Most speeds picked from the sweep, 2 to 6
fit speeds Default FIT
speeds 8, 15, 30, 60, 120 Speeds used when the sweep shows nothing clearly above noise
sweep 10, 150, 10 Range of the quick sweep (20 speeds spread on a log scale), and the default range and step of MCLIB_RIPPLE_SWEEP
probe 0.015 Size of the test corrections (A)
cruise_time 0.5 Steady-speed time per test move (s)
passes 2 Default PASSES
fan_hold, fan_settle 0.5, 3 Board fan speed held during the test, and the time it waits for them to settle (s)

Other commands

Command What it does
MCLIB_RIPPLE_MEASURE STEPPER=stepper_x SPEED=20 Vibration of ripples 1 to 8 at one motor speed (default 20, 5 to 150 mm/s), per direction, with each one's frequency and noise level. Takes PASSES.
MCLIB_RIPPLE_SWEEP STEPPER=stepper_x Peak vibration per ripple over SPEED_MIN, SPEED_MAX and SPEED_STEP (default from sweep, at most 40 speeds). Also HARMONICS (default all 8) and PASSES (default 1). Writes every speed to /tmp/mclib_ripple_<stepper>_<NAME or time>.csv.
MCLIB_SET_RIPPLE STEPPER=stepper_x Shows the live vfa_delay and vfa_<n> tables. CLEAR=1 removes them until restart (back to stock damping); add HARMONIC=<n> for one ripple. SAVE=1 stores the live tables for SAVE_CONFIG.

All of them need X and Y homed.

What it saves

The result goes under [mclib stepper_x] and [mclib stepper_y] in the saved part of printer.cfg:

  • vfa_<n> for ripple n: groups of 5 numbers, one group per calibrated speed (up to 6): electrical frequency (Hz), forward amplitude (A), forward phase (rad), reverse amplitude, reverse phase. A single group at 10000 Hz holds one value at every speed. Klipper refuses to start with an amplitude over 0.1 A.
  • vfa_delay: the current control lag the correction runs ahead of, in µs. 75 if unset.

Old tables named ripple_<n> are ignored; see Ripple correction.

Troubleshooting

Message What to do
VFA calibration is unavailable during a print Wait for the print to end, or cancel it.
VFA calibration needs all four tools in their docks: T<n> isn't Put that tool back in its dock and run it again.
AXIS must be X, Y or XY Fix the AXIS value.
Home X and Y first Only from the MCLIB_RIPPLE_* commands: run G28 first. VFA_MOTORS homes itself.
<stepper> VFA calibration didn't reduce the vibration; kept the previous correction and saved nothing ... Not a failure: the new values didn't beat the old ones, and the macro carries on with the other motor. Check the accelerometer and run it again.
No accelerometer data from lis2dw, or accelerometer samples missing in 3 moves in a row The toolhead accelerometer gave no data or broken data. The previous correction is put back. Check the tool is seated, run ACCELEROMETER_QUERY, and try again.
ripple correction needs [mclib <stepper>] and newer mainboard firmware The mainboard firmware is too old. Let the updater flash the boards (see Firmware, installer and updates).
Missing dock confirmation for T0..T3 right after a restart Motion is blocked for a while after Klipper starts. Wait a minute or two and run it again.