I am working on a shutdown/start up system for a car application.
I have all the power distribution and conversion working and indeed everything works, but I have an issue.
I am using a relay to act as a power button, connected to GPIO pins 5/6, the relay is held open when the engine is running and when the key goes off the relay closes the circuit to pins 5/6 thus initiating the shut down via script.
When the engine starts back up, the relay is charged and the circuit is opened and the PI wakes up.
All good.
I used this guide to create my shutdown system:
https://howchoo.com/g/mwnlytk3zmm/how-t ... spberry-pi
I modified one part of the code to make a 45 min delay in the shutdown, this is so I can access the PI via wifi and collect files from it or whatever when I get home.
First off, I am lousy at scripting, I just don't do enough to keep it active in my mind so I forget what I learned a few weeks later when I run into any need of it again.
So please bear with me and please if you can help
So here is my problem, when I go to the store, I shut down the engine, the auto shut down begins, I come back 20 min later and start the engine.
The shut down is still running, 25 min later the RPI shuts down, I am still driving...
How can I modify the script to cancel the shut down if it detects pins 5/6 are restored to the open circuit state?
I am fairly certain I should be able to add a few lines to this script:
#!/usr/bin/env python
import RPi.GPIO as GPIO
import subprocess
GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(3, GPIO.FALLING)
subprocess.call(['shutdown', '-h', '+45'], shell=False)
But with my limited knowledge, I am hoping someone can save me many hours of wasted time and effort
Thank you in advance!