Hi all,
after 2 days hard work, i bring the Audiophonics Power Management Module to work.
If i push the power button short, it will be shutdown and go off.
The power LED will go after success boot from blinking to constant light.
Here are the doings that i made via SSH:
pacman -S nano
pacman -S wiringpi
mkdir /home/root
cd /home/root
-----------------------------------------------------------------
nano /home/root/softshutdown.sh
#!/bin/bash
#Audiophonics
#Shutdown detection script
#Script to set GPIO 4 High for 1sec
PATH=/usr/bin
echo âSetting pin GPIO4 Highâ
gpio mode 7 out
gpio write 7 1
/bin/sleep 1
echo âSetting pin GPIO4 Lowâ
gpio write 7 0
echo âRaspberryPi shutdownâ
shutdown -h -P now
exit 0
Test softshutdown:
bash /home/root/softshutdown.sh &
-----------------------------------------------------------------
nano /home/root/softreboot.sh
#!/bin/bash
#Audiophonics
#Shutdown detection script
#Script to set GPIO 4 High for 1sec
PATH=/usr/bin
#Script to set GPIO 4 High and Reboot
#Reboot blink will stop after Boot OK return
echo âsetting pin GPIO 4 Highâ
gpio -g mode 4 out
gpio -g write 4 1
echo âRaspberry Pi Rebootâ
reboot
exit 0
Test softreboot:
bash /home/root/softreboot.sh &
-----------------------------------------------------------------
nano /home/root/sds.sh
#!/bin/bash
#RoPieee version
PATH=/usr/bin
echo âAudiophonics Shutdown script startingâŚâ
echo "Asserting pins : "
echo âShutDown : GPIO17=in, Lowâ
echo âBootOK : GPIO22=out, Highâ
echo âSoftSD : GPIO04=out, Lowâ
gpio -g mode 04 out
gpio -g write 04 0
gpio -g mode 17 in
gpio -g write 17 0
gpio -g mode 22 out
gpio -g write 22 1
while [ 1 ]; do
if [ â$(gpio -g read 17)â = â1â ]; then
echo âShutDown order received, RaspBerry pi will now enter in standby modeâŚâ
shutdown -h -P now
break
fi
/bin/sleep 0.25
done
exit 0
Test sds
bash /home/root/sds.sh &
-----------------------------------------------------------------
nano /lib/systemd/system/pwrmgmt.service
[Unit]
Description=Power Management Module
[Service]
Type=oneshot
ExecStart=bash /home/root/sds.sh &
[Install]
WantedBy=multi-user.target
systemctl enable pwrmgmt.service
Test pwrmgmt.service:
systemctl start pwrmgmt.service
-----------------------------------------------------------------
Script will be autorun after next reboot