From 8d672cccb6d7f8c515c2e8f5834bfbb0e5a4a381 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 3 Mar 2026 13:19:51 -0500 Subject: [PATCH] Update pacsat-config.sh add main and simulated --- groundstation/pacsat-config.sh | 160 +++++++++++++++++++++------------ 1 file changed, 101 insertions(+), 59 deletions(-) diff --git a/groundstation/pacsat-config.sh b/groundstation/pacsat-config.sh index c3f9a00c..2eb59921 100755 --- a/groundstation/pacsat-config.sh +++ b/groundstation/pacsat-config.sh @@ -19,22 +19,18 @@ sudo killall -9 direwolf &>/dev/null # profile=$(zenity --text="Choice:" --list 2>/dev/null --width=410 --height=120 --title="PacSat Ground Station Choice" --column="Choice" --column="Result" "PacSat" "Receive from CubeSatSim PacSatSim" "Configure" "Configure PacSat Ground Station" "Loopback" "Run a Locally Simulated PacSat") # echo $profile - echo "Here are the PacSat Ground Station configuration choices:" + echo "Here are the PacSat configuration choices:" echo - echo "1. Set PacSat Ground Station Callsign" + echo "1. PacSat Ground Station Configuration" echo - echo "2. Set Remote PacSat Satellite Callsign in Ground Station configuration" - echo - echo "3. Set Frequencies" + echo "2. PacSat Ground Station Loopback Configuration" echo - echo "4. Reset PacSat Ground Station Configuration" - echo - echo "5. Reset PacSat Ground Station Loopback Configuration" - echo - echo "6. Reset PacSat Satellite" + echo "3. Set Frequencies" echo - echo "Which do you choose? Enter 1 - 5" - + echo "4. Reset PacSat Satellite" + echo + echo "Which do you choose? Enter 1 - 4" + read -r ANS if [ -z "$ANS" ]; then @@ -48,42 +44,106 @@ sudo killall -9 direwolf &>/dev/null fi if [ "$ANS" = "1" ] ; then + + echo "Here are your PacSat Ground Station Configuration choices:" + echo + echo "1. PacSat Ground Station Callsign" + echo + echo "2. Set Remote PacSat Satellite Callsign in Ground Station configuration" + echo + echo "3. Reset PacSat Ground Station Configuration" + + read -r ANS - echo "You have chosen to set the PacSat Ground Station Callsign" - echo - - /home/pi/CubeSatSim/config -c n - - elif [ "$ANS" = "2" ] ; then - - echo "You have chosen to set the remote CubeSatSim PacSat Satellite callsign in ground station configuration" - echo + + if [ -z "$ANS" ]; then + + echo "No choice made. Exiting." + + sleep 3 + + exit + + fi - oldcallsign=$(grep -oP '(?<=bbsCallsign=).*(?=-)' /home/pi/PacSatGround/spacecraft/PacSatSim.properties) + if [ "$ANS" = "1" ] ; then - echo "Current value of remote PacSat callsign is" - echo $oldcallsign - echo + oldcallsign=$(grep -oP '(?<=callsign=).*$' /home/pi/PacSatGround/PacSatGround.properties) - echo "Enter new callsign in all capitals: " - read callsign - - if [ -z $callsign ] ; then + echo "Callsign in PacSatGround.properties is " + echo $oldcallsign + + echo "Enter new callsign in all capitals: " + read callsign + + if [ -z $callsign ] ; then + + callsign="$1" + echo "Keeping value of" $oldcallsign - callsign="$1" - echo "Keeping value of" $oldcallsign - - else + else + + echo "Configured callsign is " + echo $callsign + + if [ ! "$callsign" = "$oldcallsign" ] ; then + + sudo sed -i "s/callsign=$oldcallsign/callsign=$callsign/g" /home/pi/PacSatGround/PacSatGround.properties + + cat /home/pi/PacSatGround/PacSatGround.properties + + fi + + elif [ "$ANS" = "2" ] ; then - sudo sed -i "s/$oldcallsign/$callsign/g" /home/pi/PacSatGround/spacecraft/PacSatSim.properties + echo "You have chosen to set the remote CubeSatSim PacSat Satellite callsign in ground station configuration" echo - echo "Changing callsign to " - echo $callsign - echo - echo "You will see the change next time you run the PacSat Ground Station" + + oldcallsign=$(grep -oP '(?<=bbsCallsign=).*(?=-)' /home/pi/PacSatGround/spacecraft/PacSatSim.properties) + + echo "Current value of remote PacSat callsign is" + echo $oldcallsign echo - fi + + echo "Enter new callsign in all capitals: " + read callsign + if [ -z $callsign ] ; then + + callsign="$1" + echo "Keeping value of" $oldcallsign + + else + + sudo sed -i "s/$oldcallsign/$callsign/g" /home/pi/PacSatGround/spacecraft/PacSatSim.properties + echo + echo "Changing callsign to " + echo $callsign + echo + echo "You will see the change next time you run the PacSat Ground Station" + echo + fi + + elif [ "$ANS" = "3" ] ; then + + echo "You have chosen to reset the PacSat Ground Station Configuration" + echo + echo "Next time you run the Ground Station you will need to Add the PacSatSim spacecraft" + echo + + sudo rm -r /home/pi/PacSatGround + + elif [ "$ANS" = "2" ] ; then + + echo "Here are your PacSat Ground Station Loopback Configuration choices:" + echo + echo "1. PacSat Ground Station Callsign" + echo + echo "2. Set Remote PacSat Satellite Callsign in Ground Station configuration" + echo + echo "3. Reset PacSat Ground Station Configuration" + + read -r ANS elif [ "$ANS" = "3" ] ; then @@ -92,25 +152,7 @@ sudo killall -9 direwolf &>/dev/null /home/pi/CubeSatSim/config -F n - elif [ "$ANS" = "4" ] ; then - - echo "You have chosen to reset the PacSat Ground Station Configuration" - echo - echo "Next time you run the Ground Station you will need to Add the PacSatSim spacecraft" - echo - - sudo rm -r /home/pi/PacSatGround - - elif [ "$ANS" = "5" ] ; then - - echo "You have chosen to reset the PacSat Ground Station Loopback Configuration" - echo - echo "Next time you run the Ground Station you will need to Add the PacSatSim spacecraft" - echo - - sudo rm -r /home/pi/PacSatGroundLoop - - elif [ "$ANS" = "6" ] ; then + elif [ "$ANS" = "4" ] ; then echo "You have chosen to reset the PacSat Satellite" echo @@ -119,7 +161,7 @@ sudo killall -9 direwolf &>/dev/null else - echo "Please enter only 1 to 5" + echo "Please enter only 1 to 4" fi