@ -39,23 +39,39 @@ if [ "$1" = "" ]; then
# sim="no"
echo "Simulated Telemetry is OFF"
fi
echo
if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
echo "HAB mode is ON"
else
echo "HAB mode is OFF"
fi
echo
echo "Current command count is:"
echo -n "Current command count is: "
cat /home/pi/CubeSatSim/command_count.txt
echo
echo
echo "Current beacon transmit mode is:"
cat /home/pi/CubeSatSim/command_tx
echo
# echo "Current beacon transmit mode is:"
# cat /home/pi/CubeSatSim/command_tx
# echo
echo "Squelch level is:"
echo -n "Squelch level is: "
echo $6
echo
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
echo "Battery saver mode is ON"
else
echo "Battery saver mode is OFF"
fi
echo
echo -e "Current sim.cfg configuration file:"
echo
echo $1 $2 $3 $4 $5 $6 $7 $8
echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo
echo "To change, include an OPTION"
@ -75,46 +91,51 @@ elif [ "$1" = "-a" ]; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
echo "Battery saver mode activated ."
if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "Battery saver mode is ON ."
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
else
echo "Not battery saver mode "
sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
echo "Battery saver mode os OFF. "
# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
fi
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
# sudo systemctl restart cubesatsim
exit
elif [ "$1" = "-m" ]; then
echo "changing CubeSatSim to CW mode"
sudo echo "m" > /home/pi/CubeSatSim/.mode
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
echo "Battery saver mode activated ."
if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "Battery saver mode is ON ."
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
else
echo "Not battery saver mode "
sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
echo "Battery saver mode is OFF. "
# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
fi
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
# sudo systemctl restart cubesatsim
exit
elif [ "$1" = "-f" ]; then
echo "changing CubeSatSim to FSK mode"
sudo echo "f" > /home/pi/CubeSatSim/.mode
if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
# sudo systemctl restart cubesatsim
exit
elif [ "$1" = "-b" ]; then
echo "changing CubeSatSim to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode
if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
# sudo systemctl restart cubesatsim
exit
@ -124,13 +145,14 @@ elif [ "$1" = "-s" ]; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
echo "Battery saver mode activated ."
if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
echo "Battery saver mode ON ."
# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
else
echo "Not battery saver mode "
sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
echo "Battery saver mode is OFF. "
# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt
fi
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
# sudo systemctl restart cubesatsim
exit
@ -157,6 +179,7 @@ elif [ "$1" = "-h" ]; then
echo " -B Change battery saver mode manually"
echo " -q Change the Squelch setting for command receiver"
echo " -F Change the rx and tx frequency"
echo " -H Chnage the HAB mode"
echo
exit
@ -179,7 +202,7 @@ elif [ "$1" = "-t" ]; then
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Do you want Simulated Telemetry ON (y/n) "
read sim
@ -196,8 +219,8 @@ elif [ "$1" = "-t" ]; then
echo
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo
echo $1 $2 $3 $4 $sim $6 $7 $8
echo $1 $2 $3 $4 $sim $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg
echo $1 $2 $3 $4 $sim $6 $7 $8 $9
echo $1 $2 $3 $4 $sim $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg
echo
echo "Restarting CubeSatSim with new configuraation file"
echo
@ -222,7 +245,7 @@ elif [ "$1" = "-c" ]; then
echo $1
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Enter callsign in all capitals: "
read callsign
@ -236,8 +259,8 @@ elif [ "$1" = "-c" ]; then
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo $callsign $2 $3 $4 $5 $6 $7 $8
echo $callsign $2 $3 $4 $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg
echo $callsign $2 $3 $4 $5 $6 $7 $8 $9
echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg
fi
if [ "$norestart" = "1" ]; then
@ -268,7 +291,7 @@ elif [ "$1" = "-r" ]; then
echo $2
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo -e "Enter Reset Count (integer): "
@ -288,8 +311,8 @@ elif [ "$1" = "-r" ]; then
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo $1 $resets $3 $4 $5 $6 $7 $8
echo $1 $resets $3 $4 $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg
echo $1 $resets $3 $4 $5 $6 $7 $8 $9
echo $1 $resets $3 $4 $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg
fi
if [ "$norestart" = "1" ]; then
@ -321,7 +344,7 @@ elif [ "$1" = "-l" ]; then
echo $3
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo -e "Enter latitude (decimal degrees, positive is north): "
@ -363,8 +386,8 @@ elif [ "$1" = "-l" ]; then
fi
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo $1 $2 $lat $long $5 $6 $7 $8
echo $1 $2 $lat $long $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg
echo $1 $2 $lat $long $5 $6 $7 $8 $9
echo $1 $2 $lat $long $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg
if [ "$norestart" = "1" ]; then
echo
@ -424,11 +447,13 @@ elif [ "$1" = "-T" ]; then
sudo sed -i 's/False/True/g' /home/pi/CubeSatSim/command_tx
echo "Command state set to True to enable beacon"
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
else
sudo sed -i 's/True/False/g' /home/pi/CubeSatSim/command_tx
echo "Command state set to False to disable beacon"
echo "rebooting"
sudo systemctl stop rpitx
sudo reboot now
fi
@ -462,10 +487,10 @@ elif [ "$1" = "-B" ]; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
echo "Battery saver mode is activated ."
echo "Battery saver mode is ON ."
mode=1
else
echo "Battery saver mode is not activated ."
echo "Battery saver mode is OFF ."
mode=0
fi
@ -490,8 +515,9 @@ elif [ "$1" = "-B" ]; then
set -- $value
if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then
echo "restarting"
sudo systemctl restart cubesatsim
echo "rebooting"
# sudo systemctl restart cubesatsim
sudo reboot now
fi
elif [ "$1" = "-q" ]; then
@ -510,7 +536,7 @@ elif [ "$1" = "-q" ]; then
echo $6
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo -e "Enter squelch (integer 0 - 8): "
@ -532,8 +558,8 @@ elif [ "$1" = "-q" ]; then
echo
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo
echo $1 $2 $3 $4 $5 $sq $7 $8
echo $1 $2 $3 $4 $4 $sq $7 $8 > /home/pi/CubeSatSim/sim.cfg
echo $1 $2 $3 $4 $5 $sq $7 $8 $9
echo $1 $2 $3 $4 $4 $sq $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg
echo
echo "Restarting CubeSatSim with new configuraation file"
echo
@ -561,7 +587,7 @@ elif [ "$1" = "-F" ]; then
echo $8
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Enter tx frequency as 4XX.XXXX: "
read tx
@ -584,8 +610,8 @@ elif [ "$1" = "-F" ]; then
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo $1 $2 $3 $4 $5 $6 $tx $rx
echo $1 $2 $3 $4 $5 $6 $tx $rx > /home/pi/CubeSatSim/sim.cfg
echo $1 $2 $3 $4 $5 $6 $tx $rx $9
echo $1 $2 $3 $4 $5 $6 $tx $rx $9 > /home/pi/CubeSatSim/sim.cfg
# fi
# if [ "$norestart" = "1" ]; then
@ -596,6 +622,49 @@ elif [ "$1" = "-F" ]; then
echo
sudo systemctl restart cubesatsim
# fi
elif [ "$1" = "-H" ]; then
echo
echo "Editing the High Altitude Balloon (HAB) setting in"
echo "the configuration file for CubeSatSim"
echo
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
echo "HAB mode is ON"
else
echo "HAB mode is OFF"
fi
echo
# echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "Do you want HAB mode ON (y/n) "
read hab
echo
if [ "$hab" = "y" ] || [ "$hab" = "yes" ] ; then
hab="yes"
echo "HAB mode is ON"
else
hab="no"
echo "HAB mode is OFF"
fi
echo
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo
echo $1 $2 $3 $4 $5 $6 $7 $8 $hab
echo $1 $2 $3 $4 $5 $6 $7 $8 $hab > /home/pi/CubeSatSim/sim.cfg
echo
echo "Restarting CubeSatSim with new configuraation file"
echo
sudo systemctl restart cubesatsim
fi