klipper_faq:64_gcode_shell_commands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
klipper_faq:64_gcode_shell_commands [2023/10/21 10:35] – removed - external edit (Unknown date) 127.0.0.1 | klipper_faq:64_gcode_shell_commands [2023/10/21 10:39] (current) – [YouTube Video #64] dominik | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== G-Code Shell Commands ====== | ||
+ | **Creator of this extension is Arksine.** | ||
+ | |||
+ | This is a brief explanation of how to use the shell command extension for Klipper, which you can install with KIAUH. | ||
+ | After installing the extension you can execute linux commands or even scripts from within Klipper with custom commands defined in your printer.cfg. | ||
+ | |||
+ | ===== YouTube Video #64 ===== | ||
+ | {{youtube> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ===== Installation Shell Erweiterung ===== | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * -> '' | ||
+ | * -> '' | ||
+ | |||
+ | ===== Beispiel - direktes Kommando ===== | ||
+ | Aufruf : '' | ||
+ | |||
+ | < | ||
+ | [gcode_shell_command hello_world] | ||
+ | command: echo hello world | ||
+ | timeout: 2. | ||
+ | verbose: True | ||
+ | </ | ||
+ | |||
+ | Komplexere Kommandos können über eine eigene Shell gestartet werden und müssen in Hochkommata. \\ | ||
+ | '' | ||
+ | |||
+ | Beispiel für Rechner: \\ | ||
+ | '' | ||
+ | |||
+ | Beispiel Disk Free: \\ | ||
+ | '' | ||
+ | ===== Beispiel - Bash Script ===== | ||
+ | |||
+ | Aufruf: '' | ||
+ | |||
+ | <code | download> | ||
+ | [gcode_shell_command CmdSerial] | ||
+ | command: sh -c "sudo / | ||
+ | timeout: 5. | ||
+ | verbose: True | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | pi@Make-Voron2: | ||
+ | #!/bin/sh | ||
+ | |||
+ | ls -lR /dev/ | grep -v ' | ||
+ | |||
+ | </ | ||
+ | ===== Beispiel - Parameter übergeben ===== | ||
+ | |||
+ | Aufruf : '' | ||
+ | |||
+ | > **Hinweis: | ||
+ | |||
+ | < | ||
+ | [gcode_shell_command CmdWLED] | ||
+ | command: / | ||
+ | timeout: 5. | ||
+ | verbose: True | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | pi@Make-Voron2: | ||
+ | #!/bin/sh | ||
+ | |||
+ | echo "Call Webservice with : $1" | ||
+ | curl -X GET " | ||
+ | curl -X GET https:// | ||
+ | #echo " | ||
+ | |||
+ | Aufruf für WLED : '' | ||
+ | '' | ||
+ | '' | ||
+ | ===== Beispiel - Wiederkehrender Aufruf ===== | ||
+ | * Code 1x beim Start verzögert ausführen \\ < | ||
+ | [delayed_gcode testdelay] | ||
+ | gcode: | ||
+ | RUN_SHELL_COMMAND cmd=hello_world | ||
+ | UPDATE_DELAYED_GCODE ID=testdelay DURATION=5 | ||
+ | </ | ||
+ | * Einmalig kann man den verzögerten GCode so starten : \\ '' | ||
+ | * Beim Start wird der Code auch ausgeführt! | ||
+ | * Code immer alle x Sekunden neu starten (startet sofort mit dem Drucker!) \\ <color # | ||
+ | [delayed_gcode testdelay] | ||
+ | initial_duration: | ||
+ | gcode: | ||
+ | RUN_SHELL_COMMAND cmd=hello_world | ||
+ | UPDATE_DELAYED_GCODE ID=testdelay DURATION=5 | ||
+ | </ | ||
+ | * Webservice immer wiederkehrend aufrufen, um einen Wert zu übergeben: \\ < | ||
+ | [delayed_gcode delayedled] | ||
+ | initial_duration: | ||
+ | gcode: | ||
+ | {% if printer.print_stats.state == ' | ||
+ | {% set val = printer.display_status.progress * 100 %} | ||
+ | RUN_SHELL_COMMAND cmd=CmdWLED PARAMS={val} | ||
+ | {% else %} | ||
+ | M118 " | ||
+ | {% endif %} | ||
+ | | ||
+ | UPDATE_DELAYED_GCODE ID=delayedled DURATION=15 | ||
+ | </ | ||
+ | * Dazu muss natürlich wo oben beschrieben das Bash Script eingerichtet sein! | ||
+ | |||
+ | WLED Control auch über \\ https:// | ||
+ | |||
+ | ===== Probleme ===== | ||
+ | |||
+ | ==== Klipper nicht aktiv ==== | ||
+ | Wenn Klipper nicht aktiv ist, können die GCode Shell Kommandos nicht gestartet werden! \\ Beispiel : < | ||
+ | 20:21 Pin ' | ||
+ | 20:21 Pin ' | ||
+ | |||
+ | Once the underlying issue is corrected, use the " | ||
+ | command to reload the config and restart the host software. | ||
+ | Printer is halted | ||
+ | |||
+ | 20:21 RUN_SHELL_COMMAND cmd=CmdSerial </ | ||
+ | |||
+ | ==== verbose: True ==== | ||
+ | Viel extra Ausgabe :-) | ||
+ | |||
+ | |||
+ | ==== sudo ==== | ||
+ | < | ||
+ | 20:12 sudo: a password is required | ||
+ | 20:12 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper | ||
+ | </ | ||
+ | |||
+ | ===== Code Stuff für Prozente ===== | ||
+ | |||
+ | printer.print_stats.state : complete \\ | ||
+ | printer.print_stats.state : printing \\ | ||
+ | printer.virtual_sdcard.progress : 0.06650429377548903 \\ | ||
+ | printer.display_status.progress : 0.1 | ||
+ | |||
+ | <code | download> | ||
+ | {% if printer.heater_bed.target > 0.0 %} | ||
+ | {% set temp = printer.heater_bed.target %} | ||
+ | {% else %} | ||
+ | {% set temp = printer.configfile.config.heater_bed.max_temp %} | ||
+ | {% endif %} | ||
+ | </ | ||
+ | |||
+ | ===== Links ===== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * REST Test \\ https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * Beispiel Coding \\ https:// | ||
+ | ===== Example ===== | ||
+ | < | ||
+ | [gcode_shell_command hello_world] | ||
+ | command: echo hello world | ||
+ | timeout: 2. | ||
+ | verbose: True | ||
+ | </ | ||