From 7d4e62b60c5b37c9a1b158380393d0fba3106dc0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 10:41:14 -0500 Subject: [PATCH] Update config fixed -T command and control setting --- config | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/config b/config index 9d74c031..e3a40b49 100755 --- a/config +++ b/config @@ -183,7 +183,7 @@ elif [ "$1" = "-h" ]; then echo " -l Change the Latitude and Longitude in the configuration file sim.cfg" echo " -S Scan both I2C buses on the Raspberry Pi" echo " -C Clear logs" - echo " -T Change command state" + echo " Change command and control state" echo " -R Change the Commands Count in the file command_count.txt" echo " -B Change battery saver mode manually" echo " -q Change the Squelch setting for command receiver" @@ -449,29 +449,38 @@ elif [ "$1" = "-C" ]; then elif [ "$1" = "-T" ]; then echo - echo "Change command state" + echo "Change command and control state" echo - echo "Current command state is:" - cat /home/pi/CubeSatSim/command_tx - echo + FILE=/home/pi/CubeSatSim/command_control + if [ -f "$FILE" ]; then + echo "Radio command and control is ON" + echo "Do you want to turn command and control to OFF (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control set to OFF" + sudo rm /home/pi/CubeSatSim/command_control + echo "rebooting" + sudo systemctl stop rpitx + sudo reboot now + fi + + else + echo "Radio command and control is OFF" + echo "Do you want to set beacon transmit to ON (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control set to ON" + sudo touch /home/pi/CubeSatSim/command_control + echo "rebooting" + sudo systemctl stop rpitx + sudo reboot now + fi - echo "Do you want to set beacon transmit to ON (y/n) " - read reset - echo - - if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; 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 elif [ "$1" = "-R" ]; then