prusa3d / Prusa-Firmware

Firmware for Original Prusa i3 3D printer by PrusaResearch
GNU General Public License v3.0
2k stars 1.05k forks source link

Add Shutdown host to LCD Menu #4553

Closed sarusani closed 6 months ago

sarusani commented 7 months ago

My Raspberry Pi is powered by my printer power supply, but I was never a fan of powering it off while the OS wasn't shutdown properly. (Despite the fact that it never gave me any problems).

I'm also too lazy to go to my browser and shut the OS down before I power off the printer... So I added a "Shutdown host" menu entry. It's only showing if the printer is not active and a host is connected (M79). I placed it second last in the menu order to make it less likely to get selected by accident.

It will send the action command action:shutdown to the host. This is supported by OctoPrint (But disabled by default!)

I don't think PrusaLink currently supports it. So it's probably not something you want to add right now. But I just wanted to offer the idea/code anyway. 😸

github-actions[bot] commented 7 months ago

All values in bytes. Δ Delta to base

Target ΔFlash ΔSRAM Used Flash Used SRAM Free Flash Free SRAM
MK3S_MULTILANG 0 0 246734 5656 7218 2536
MK3_MULTILANG 0 0 246024 5663 7928 2529
3d-gussner commented 7 months ago

@sarusani Thanks for the PR and I think shutting down the RPi properly is a very good thing. Can't promise if this will be something we will consider and merge. Need to discuss that in the team and with PrusaLink.

3d-gussner commented 7 months ago

@sarusani Please enclose this feature in #define HOST_SHUTDOWN in variants files and #ifdef HOST_SHUTDOWN ... #endif //End HOST_SHUTDOWN to make it an option for custom variant. If you need some help please let me know. Did this so many times.

3d-gussner commented 7 months ago

Also as you have the LCD message Shutdown host as _I you gonna need to update the /lang/Firmware.pot and lang/Firmware_.po files and translate the message.

3d-gussner commented 7 months ago

Here a diff file you can use as an idea. I translated few languages
MK3_shutdownHostLCDEntry.diff.txt

sarusani commented 7 months ago

@3d-gussner Thanks for the diff! I added the changes.

Some translations are still missing (hu, ro, sk) and the ones I added (cs, hr, pl) should be checked.

petrubecheru commented 7 months ago

Some translations are still missing (hu, ro, sk) and the ones I added (cs, hr, pl) should be checked.

For Romanian: Shutdown host is Oprește gazda

But I think that Shutdown RPi (en) [Oprește RPi (ro)] is a better message

3d-gussner commented 7 months ago

@petrubecheru Thanks for the update. We should keep host as there are more options to run the host. PC, old notebooks, SBCs ...

AttilaSVK commented 7 months ago

Hi! The correct translation should be Gazdagép leállítása

but that’s too long, so either Gazdagép leállítás

or Gazdagép leállít.

are usable shorter alternatives.

Cheers,

Attila

On Fri, 5 Jan 2024 at 16:54, 3d-gussner @.***> wrote:

@.**** commented on this pull request.

In lang/po/Firmware_hu.po https://github.com/prusa3d/Prusa-Firmware/pull/4553#discussion_r1443038507 :

@@ -2592,6 +2592,11 @@ msgstr "Készen nem áll" msgid "Reprint" msgstr "Újranyomtatás"

+#. MSG_SHUTDOWN_HOST c=18 +#: ../../Firmware/messages.cpp:108 ../../Firmware/ultralcd.cpp:5342 +msgid "Shutdown host" +msgstr ""

@AttilaSVK https://github.com/AttilaSVK @Hauzman https://github.com/Hauzman Please provide a translation.

— Reply to this email directly, view it on GitHub https://github.com/prusa3d/Prusa-Firmware/pull/4553#pullrequestreview-1806215913, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIZ6Q5KC6VFLMWPJJP5AZFDYNAOZ3AVCNFSM6AAAAABBHWBUUOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQMBWGIYTKOJRGM . You are receiving this because you were mentioned.Message ID: @.***>

petrubecheru commented 6 months ago

Need to discuss that in the team and with PrusaLink.

prusalink has shutdown command: https://github.com/prusa3d/Prusa-Link-Web/blob/68fb6d0aca7fd56bb1f5390e253c8df287a320b1/spec/openapi-legacy.yaml#L537