Jump to content

Recommended Posts

Posted

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

Posted

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...