How to override M117 and still call base command?

I’ve been trying to figure out how to override the M117 command to be able to not only to perform the native behavior but also mirror the messages on the console.

I can successfully use rename_existing: M117.1 to make a macro for it, but calling the base behavior is quite tricky as this command is not based on parameters…

Unless I’m missing something here, there is no way to get the full command line as it was executed, so I’ve created a pull request to add a command_line pseudo-variable that allows me to get the whole command and then use that directly, like so:

[gcode_macro M117]
rename_existing: M117.1
gcode:
  {% set message = commandline[5:] %}
  M117.1 { message }
  M118 { message }

If anyone has a better way to do this, I am interested in hearing! :slightly_smiling_face:

1 Like

That PR has my vote. :grin: There was discussion around this a few months back:

1 Like

Oh, I missed that, thank you for pointing it out!

And yes, this PR would fix that situation! :slightly_smiling_face:

As far as I know, it would, in practice, require a code change as indicated.

-Kevin

Given that, up to you then if it’s a good PR to merge or if it needs changes as I do believe there is value on such a thing! :slightly_smiling_face:

Hi!
I’ve read a discussion regarding your PR.
Could you please tell, if you finally managed to get M117 to be mirrored in the console? If yes, could you please tell how you did it?
Thx!

Hi, I did indeed and that is now part of the docs here: Commands templates - Klipper documentation (klipper3d.org)

This is the one I use with my printer!

1 Like