From 10aeddf6b735a121da3909aa05469081f0b5799a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 12:05:57 -0500 Subject: [PATCH] Update config added squelch setting --- config | 67 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/config b/config index 6dbc3742..76ccc3b5 100755 --- a/config +++ b/config @@ -51,7 +51,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 + echo $1 $2 $3 $4 $5 $6 echo echo "To change, include an OPTION" @@ -125,6 +125,7 @@ elif [ "$1" = "-h" ]; then echo " -C Clear logs" echo " -T Change command state" echo " -R Change the Commands Count in the file command_count.txt" + echo " -q Change the Squelch setting for command receiver" echo exit @@ -190,7 +191,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 +# echo $1 $2 $3 $4 $5 $6 echo "Enter callsign in all capitals: " read callsign @@ -204,8 +205,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 - echo $callsign $2 $3 $4 $5 > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 + echo $callsign $2 $3 $4 $5 $6 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -236,7 +237,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 +# echo $1 $2 $3 $4 $5 $6 echo -e "Enter Reset Count (integer): " @@ -256,8 +257,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 - echo $1 $resets $3 $4 $5 > /home/pi/CubeSatSim/sim.cfg + echo $1 $resets $3 $4 $5 $6 + echo $1 $resets $3 $4 $5 $6 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -289,7 +290,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 +# echo $1 $2 $3 $4 $5 $6 echo -e "Enter latitude (decimal degrees, positive is north): " @@ -331,8 +332,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 - echo $1 $2 $lat $long $5 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 + echo $1 $2 $lat $long $5 $6 > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -420,6 +421,52 @@ elif [ "$1" = "-R" ]; then else echo "Commands count not reset" fi +elif [ "$1" = "-q" ]; then + + echo + echo "Editing the Squelch setting in" + echo "the configuration file for CubeSatSim" + echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo + echo "Current value of squelch is" + echo $6 + echo + +# echo $1 $2 $3 $4 $5 $6 + + echo -e "Enter squelch (integer 0 - 8): " + + read sq + + if [ -z $sq ] ; then + + sq="$6" + echo "Keeping value of" $lat + fi + + if ! [[ $sq =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then + + echo "Error: not a number!" + sq="$6" + echo "Keeping value of" $sq + fi + + echo + echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + echo + echo $1 $2 $3 $4 $5 $sq + echo $1 $2 $3 $4 $4 $sq > /home/pi/CubeSatSim/sim.cfg + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + + sudo systemctl restart cubesatsim + fi # sudo systemctl restart cubesatsim