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