Posts: 98
Threads: 16
Joined: Jun 2019
Reputation:
3
Running a MacArthur Hat, latest version, Openplotter ...
I have the power down enabled through OpenPlotter settings, GPIO 21 and 26, just as they should be, its made the correct entries in firmware/config.txt
I have a second pi configured the same way for guages/kiosk
When I remove the switched 12V the kiosk takes 3 or 4 seconds to shut down, as it should .. the plotter shuts down in around 1 second ...
Every time a boot, OpenCPN complains it was not shutdown correctly. This frequently cause issues, as OpenCPN like to run with its config file open for writes, which leads to corruption.
I added added a 10 second delay to shutdown.py after the pkil and before the halt ... and it still shuts down in 1 second or so ... I'm now stumped. The only way it can know it is supposed to be shutting down is presumably if shutdown.py spots the pin going low and begins the shutdown process .. but that shoud hit the sleep(10) .. which it isnt.
Clues? Ideas? This is doing my head in ... to save anyone asking if I have the pins configured correctly:
Posts: 98
Threads: 16
Joined: Jun 2019
Reputation:
3
Solved, it was and is an OpenPlotter issue on the Pi5 ... solved it manually on mine. On a Pi5 there is no pullup on GPIO with the standard OpenPLotter overly line added to config.txt and no hardware pullup on the MacArthur hat ... as a result, when the switched power was removedthere was no "keep the power alive intil I am done" signal coming out of the Pi and the system shut down instantly.
Sticking a scope on GPIO 26 showed it low at all times.
For anyone that cares you need to add this line on a Pi5 to make your shutdown work as intended, otherwise it will shut down, just a lot faster than it should and not in a nice way!
Posts: 20
Threads: 4
Joined: Feb 2025
Reputation:
0
I can not get this to work with my Pi5. It shuts down "ok", but next time I get a warning. OpenCPN user interface closes "normally", then there is about 5 sec pause and then pi powers down. So there is time to close files, but something fails.
dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=up
dtoverlay=gpio,pin26,pull=up
dtoverlay=gpio-poweroff,gpiopin=26,active_low=1
I really do not understand why there are discrepansies in keywords in dtoverlay lines, but that#s the way it is. I have also tried playing with the pin26 line...
Posts: 341
Threads: 27
Joined: Apr 2019
Reputation:
7
(2025-11-30, 05:50 PM)luu5 Wrote: I can not get this to work with my Pi5. It shuts down "ok", but next time I get a warning. OpenCPN user interface closes "normally", then there is about 5 sec pause and then pi powers down. So there is time to close files, but something fails.
dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=up
dtoverlay=gpio,pin26,pull=up
dtoverlay=gpio-poweroff,gpiopin=26,active_low=1
I really do not understand why there are discrepansies in keywords in dtoverlay lines, but that#s the way it is. I have also tried playing with the pin26 line...
 I tried that too, but it still doesn't work.
I think @sailog will have to intervene.
Posts: 20
Threads: 4
Joined: Feb 2025
Reputation:
0
(2025-12-02, 11:26 AM)Max1947 Wrote: (2025-11-30, 05:50 PM)luu5 Wrote: I can not get this to work with my Pi5. It shuts down "ok", but next time I get a warning. OpenCPN user interface closes "normally", then there is about 5 sec pause and then pi powers down. So there is time to close files, but something fails.
dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=up
dtoverlay=gpio,pin26,pull=up
dtoverlay=gpio-poweroff,gpiopin=26,active_low=1
I really do not understand why there are discrepansies in keywords in dtoverlay lines, but that#s the way it is. I have also tried playing with the pin26 line...
I tried that too, but it still doesn't work.
I think @sailog will have to intervene.
I hope he will.
Posts: 3,206
Threads: 66
Joined: Mar 2016
Reputation:
310
You don't need to edit the config.txt file. Safe shutdown will work without adding that line.
The problem is that the latest version of OpenCPN no longer shuts down correctly and always displays the warning. You can try opening OpenCPN and safely shutting it down from a terminal:
pkill -15 opencpn
When you open it again, you'll see the warning. This is something you need to report to OpenCPN.
Posts: 20
Threads: 4
Joined: Feb 2025
Reputation:
0
(2025-12-11, 06:31 PM)Sailoog Wrote: You don't need to edit the config.txt file. Safe shutdown will work without adding that line.
The problem is that the latest version of OpenCPN no longer shuts down correctly and always displays the warning. You can try opening OpenCPN and safely shutting it down from a terminal:
pkill -15 opencpn
When you open it again, you'll see the warning. This is something you need to report to OpenCPN.
If I close OpenCPN from the "x" it shuts down and does not present "safe mode start" dialogue. But if I use pkill, it will complain.
Posts: 3,206
Threads: 66
Joined: Mar 2016
Reputation:
310
2025-12-12, 01:35 PM
(This post was last modified: 2025-12-12, 01:36 PM by Sailoog.)
Yes, using `x` closes OpenCPN from within, which is always safe. Using `pkill -15` closes OpenCPN safely from outside, which used to work, but no longer does. But the MacArthur HAT is working as expected sending pkill -15 opencpn before shutdown.
Posts: 20
Threads: 4
Joined: Feb 2025
Reputation:
0
Should be corrected in the next release.
|