Add a shutdown button
-
Hello,
I want to add a shutdown button to my recalbox, and I'm using a device that takes the pins that this tutorial uses. I decided on using PIN 13 (GPIO27) instead of PIN 5 because it's unpopulated.
At the moment I'm trying to modify the code used by the recalbox script to accomplish the same functionality as when using pins 5 and 6 but I can't get it to work. I changed all the mentions to PIN GPIO3 with GPIO27 (lines that had (3, GPIOwhatever) changed to 27,GPIOwhatever) but it still doesn't run. Is there anything else I have to change to get this to work properly? I tried making my own script but it was shutting down way too slow (it even stopped waiting for some reason instead of fully shutting down immediately) so I'd like to have the same behavior as the recalbox script has, by using my own pin.
Thanks.
-
@webodan WHich script are you using/modifying?
-
Hello @supernature2k,
I've modded /recalbox/scripts/rpi-pin56-power.py leaving it like this:
import RPi.GPIO as GPIO
import osGPIO.setmode(GPIO.BCM)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def shutdown():
os.system("shutdown -h now")GPIO.wait_for_edge(27, GPIO.FALLING)
shutdown()
It does work, but I have to push the button twice so it shuts down fully, if possible i'd like it to close the emulator and shut down fully in one press.
Thanks in advance.
edit: i've attempted removing GPIO.wait_for_edge(27, GPIO.FALLING) it did shutdown properly in the first try, but after rebooting back to the library it keeps shutting down automatically so that's not what i want
-
Did you manage to make it work? I am looking for the same thing, to change from gpio3 (5) to any other.