Print value of Variable to console?

Basic Information:

Printer Model: Tronxy X5SA
MCU / Printerboard: Chitu-V6
klippy.log
klippy.log (3.8 MB)

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

Probably lame question but I honestly wasnt able to google any answer:
How do I print current value of the variable to the console? (I am debugging slow extrusion and would like to know what is default/current value of max_extrude_only_velocity)

I took this from the klipper templates page. Hopefully will be of use to you M117 with show a message on your klipper screen. Not sure it appears in console. But hopefully useful for your purposes.

Macro parameters

It is often useful to inspect parameters passed to the macro when it is called. These parameters are available via the params pseudo-variable. For example, if the macro:

[gcode_macro SET_PERCENT]
gcode:
  M117 Now at { params.VALUE|float * 100 }%

were invoked as SET_PERCENT VALUE=.2 it would evaluate to M117 Now at 20%. Note that parameter names are always in upper-case when evaluated in the macro and are always passed as strings. If performing math then they must be explicitly converted to integers or floats.

1 Like

M117 prints it to the printer’s display (if there is one)

If you want to have to the frontend’s console/terminal, you have to use M118.
You have to activate M118 in the printer.cfg first.

https://www.klipper3d.org/Config_Reference.html#respond

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.