Jump to content

Recommended Posts

Geschrieben

Dear list

For a measurement-device, I had to implement a delayed shutdown of the entire device. The device is a RPi in combination with a HAT. The delayed shutdown and power-cut is realized using a manual switch and a IndustrialDualRelais. You will find a more detailed description in the following thread (last entry): Combined power-supply of HAT and RPi

Reason for the delay is, to provide more time to the RPi to write all data to the disk.

The approach described in the link above works perfectly. But ...

I am cutting the power-supply of the RPi the hard-way without running a proper shutdown of the RPi. But if I am calling a correct shutdown of the RPi by

 os.system("sudo shutdown now")

the HAT will not react anymore and the used HAT-funktion

hat.set_sleep_mode(0, 2**32-1, True, True, False)

is not working/called anymore.

Question:

  • Any ideas to combine a shutdown of the RPi, the hat.set_sleep_mode and the following cut of the entire power-supply?

Looking forward to any ideas and hints.

Cheers. Yvo

Geschrieben

The first parameter of set_sleep_mode() is the sleep delay. If you don’t pass 0 but guess how long it takes to shut down the system and then enter that, it should work as expected.

For example, if the shutdown usually takes 10 seconds, just pass 15 to set_sleep_mode() and then call "shutdown now".

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...