seho85 / klipper-dgus

A python project to connect a DGUS display to Klipper
GNU General Public License v3.0
44 stars 12 forks source link

Shutting down Raspberry from display #64

Open niklasb22 opened 1 year ago

niklasb22 commented 1 year ago

Hello, First of all, thank you for the great project. I like using it very much. It would be great if it were possible to shut down the Klipper Host, i.e. the Raspberry Pi, from the display.

Maybe that can be implemented. Many thanks

seho85 commented 1 year ago

Hi,

this can be done. But for performing a shutdown an additional plugin for klipper has to be installed.

https://github.com/th33xitus/kiauh/blob/master/docs/gcode_shell_command.md

You should be able to achieve shutting down the pi already by editing the _[gcode_macro DGUS_USERPOS2] https://github.com/seho85/klipper-dgus/blob/b3c715dfc0f2654264b783918bc585a63bdba223/config/dgus_display_macros.cfg#L58

1) define a g_code_shell_command

[gcode_shell_command shutdown_pi]
command: poweroff

2) and the _[gcode_macro DGUS_USERPOS2]

[gcode_macro DGUS_USER_POS2]
gcode:
    RUN_SHELL_CMD CMD=shutdown_pi

The shutdown would be performed by pressing the "Pos 2" Button on the "Homing" Mask.