Basic Information:
Printer Model: Voron 2.4r2
MCU / Printerboard: Octopus
Host / SBC: Raspberry Pi 4
klippy.log
klippy.log (290.8 KB)
Describe your issue:
I’m trying to write a wrapper for my CLEAN_NOZZLE to make the LEDs do some stuff while cleaning but I ran into a problem that I CANNOT figure out. I’ve boiled the problem down to this:
[gcode_macro BOB]
gcode:
G28
[gcode_macro BOB]
rename_existing: BOB_NEW
gcode:
G28
which does not work in my klipper. If I try to do this, klipper fails with: Existing command 'BOB' not found in gcode_macro rename.
What am I missing? This should be working right?
The klippy.log has both the broken case and working case (with the macro redefinition commented out).
I noticed when reviewing the klippy.log that when the rename macro is in place the original macro is no longer found. It’s like the pre-processor removed the original and then couldn’t find it on the subsequent rename_existing directive.
Looking closer at the docs, maybe I cannot define a macro and use rename_existing on it with a new macro…
#rename_existing:
# This option will cause the macro to override an existing G-Code
# command and provide the previous definition of the command via the
# name provided here. This can be used to override builtin G-Code
# commands. Care should be taken when overriding commands as it can
# cause complex and unexpected results. The default is to not
# override an existing G-Code command.
It specifies that it can be used to override builtin G-Code commands. I guess we cannot rename_existing macros with this function – only built-in.
I worked around this issue by just completely redefining the complete BOB macro later in my configuration (without the use of redefine_existing) and that seems to be working just fine.