#Set printer name in Mainsail with a gcode macro

12 messages ยท Page 1 of 1 (latest)

flint void
#

The headline says it all. Is this possible?
I can run shell commands via gcode. Hence, if there is a specific file in which the printer name is saved, I could go down this route. Unfortunately, I can't find the corresponding file...Any suggestion welcome ๐Ÿ™‚

valid garnet
#

Nope, the name as any other setting you do in mainsail is stored in the moonraker database

#

Honestly asking, why you ever need to change the name of your printer via gcode?

#

If you want to go deeper in that rabbit hole the database is stored in ~printer_data/database but do not expect any support how to alter that.

flint void
#

Thanks for the swift reply. The reason why I want to change name via gcode is because I am changing printer profiles via gcode. would be a nice touch to show the active profile (acceleration, stepper currents, etc.) in the printer name field...I'll have a look at the database. Wish me luck ๐Ÿ™‚ Thanks again!

valid garnet
#

While printing you could use a M117 <your text> to show that, this line would appear below or above (not sure atm) the thumbnail. And add a M117 to clear it at the print end.

#

http://<your printer ip>/server/database/item?namespace=mainsail shows you a json output of the mainsail part of the database. Take a look in that, that you understand the complexity before you spend more time in it.

#

If you break that structure by accident all settings are gone and best thing would be to start with a factory resets of the settings

flint void
#

I'll be super careful for sure ๐Ÿ™‚

glacial surge
#
cd /home/pi/klipper/klippy/extras/
wget https://raw.githubusercontent.com/th33xitus/kiauh/master/resources/gcode_shell_command.py
[gcode_shell_command hello_world]
command: echo hello world
timeout: 2.
verbose: True
[gcode_macro HELLO_WORLD]
gcode:
    RUN_SHELL_COMMAND CMD=hello_world
glacial surge
#

Example I did a QRCode scanner

[gcode_shell_command qrcode_snapshot]
command: wget http://IP/webcam/?action=snapshot -O /home/pi/printer_data/gcodes/qrcode.jpg
verbose: True
timeout: 2.
[gcode_shell_command qrcode_scanner]
command: zbarimg /home/pi/printer_data/gcodes/qrcode.jpg
verbose: True
timeout: 2.
[gcode_macro QRCode_Scan]
gcode:
    RUN_SHELL_COMMAND CMD=qrcode_snapshot
    RUN_SHELL_COMMAND CMD=qrcode_scanner