Skip to content

Converting to Dynamic Macros

Follow this tutorial to convert your standard gcode_macro to a Dynamic Macro.

printer.cfg

First, remove the include line in your printer.cfg referencing the file your macros are in. For example, if your macros are in macros.cfg, remove the line:

[include macros.cfg]

from your printer.cfg.

Dynamic Macros Configuration

Next, if you don't already have one, create a [dynamicmacros] config section in your printer.cfg and add your macro configuration to it:

printer.cfg
1
2
3
[dynamicmacros]
config_path: ~/printer_data/config # If you left your printer configuration path as the default, you don't need to specify this
configs: macros.cfg # You can add more files to this list, separated by commas.
Fluidd and KlipperScreen

If your Fluidd macros list is empty or your dynamic macros don't appear in KlipperScreen's macros list, you can add the following parameter to your [dynamicmacros] config section:

interface_workaround: true
KlipperScreen

If you convert your LOAD_FILAMENT and UNLOAD_FILAMENT macros to be dynamic, KlipperScreen may not recognize them and report an error. To fix this, add blank macros to your printer.cfg, before your [dynamicmacros] section. Example:

printer.cfg
1
2
3
4
5
6
[gcode_macro LOAD_FILAMENT]
gcode:
    M117 LOAD
[gcode_macro UNLOAD_FILAMENT]
gcode:
    M117 UNLOAD

Unknown config object 'gcode_macro'

If you are getting a "Unknown config object 'gcode_macro'" error after converting your macros to Dynamic Macros, move your [dynamicmacros] section to be after your [virtual_sdcard] section.

Nacro Names

Klipper has certain macro names reserved for core functionality. If you are experiencing errors, don't name your Dynamic Macros any of the following:

  • PAUSE
  • RESUME
  • CANCEL_PRINT

If you want to make those macros dynamic, first define them as a standard GCode macro:

1
2
3
[gcode_macro PAUSE]
gcode:
    DYNAMIC_PAUSE

Restart Klipper.

That's it. Your macros are now Dynamic Macros.

Comments