added new sixfab HAT to ppp installer script

This commit is contained in:
Yasin Kaya 2019-04-12 16:47:20 +03:00
parent c0118f37f8
commit f7782d7b2b
3 changed files with 52 additions and 14 deletions

15
ppp_installer/install.sh Normal file → Executable file
View File

@ -8,17 +8,19 @@ SET='\033[0m'
echo "${YELLOW}Please choose your Sixfab Shield:${SET}"
echo "${YELLOW}1: GSM/GPRS Shield${SET}"
echo "${YELLOW}2: 3G, 4G/LTE Base Shield${SET}"
echo "${YELLOW}3: Cellular IoT Shield${SET}"
echo "${YELLOW}3: Cellular IoT App Shield${SET}"
echo "${YELLOW}4: Cellular IoT HAT${SET}"
read answer
case $answer in
1) echo "${YELLOW}You chose GSM/GPRS Shield${SET}";;
2) echo "${YELLOW}You chose Base Shield${SET}";;
3) echo "${YELLOW}You chose Cellular Iot Shield${SET}";;
*) echo "${YELLOW}You did not chose 1, 2 or 3${SET}"; exit 1;
3) echo "${YELLOW}You chose CellularIoT Shield${SET}";;
4) echo "${YELLOW}You chose CellularIoT HAT${SET}";;
*) echo "${YELLOW}You did not chose 1, 2,3 or 4${SET}"; exit 1;
esac
if [ $answer -eq 3 ]; then
if [ $answer -eq 3 || $answer -eq 4 ]; then
echo "${YELLOW}Please choose LTE Technology:${SET}"
echo "${YELLOW}1: GPRS/EDGE${SET}"
echo "${YELLOW}2: CATM1${SET}"
@ -139,8 +141,11 @@ do
elif [ $answer -eq 3 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot -O reconnect.sh
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot_app -O reconnect.sh
elif [ $answer -eq 4 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot -O reconnect.sh
fi
mv reconnect.sh /usr/src/

View File

@ -1,22 +1,22 @@
#!/bin/sh
gpio -g mode 20 in
gpio -g mode 11 out
gpio -g mode 26 out
gpio -g mode 23 in #status
gpio -g mode 24 out #powerkey
gpio -g mode 17 out #enable
gpio -g write 26 0
gpio -g write 17 1
sleep 1
gpio -g write 26 1
gpio -g write 17 0
while true; do
if [ $(gpio -g read 20) = "1" ]; then
if [ $(gpio -g read 23) = "0" ]; then
echo "Power up"
gpio -g write 11 0
gpio -g write 11 1
gpio -g write 24 0
gpio -g write 24 1
sleep 2
gpio -g write 11 0
gpio -g write 24 0
sleep 2
else
ping -I ppp0 -c 1 8.8.8.8

View File

@ -0,0 +1,33 @@
#!/bin/sh
gpio -g mode 20 in
gpio -g mode 11 out
gpio -g mode 26 out
gpio -g write 26 0
sleep 1
gpio -g write 26 1
while true; do
if [ $(gpio -g read 20) = "1" ]; then
echo "Power up"
gpio -g write 11 0
gpio -g write 11 1
sleep 2
gpio -g write 11 0
sleep 2
else
ping -I ppp0 -c 1 8.8.8.8
if [ $? -eq 0 ]; then
echo "Connection up, reconnect not required..."
else
echo "Connection down, reconnecting..."
sudo pon
fi
fi
sleep 1
done