From 1cb22b1d43f0ded74b1dfba51cd0e73539f78b32 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 1 Jan 2026 17:40:01 -0500 Subject: [PATCH] Update config use check_restart everywhere --- config | 68 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/config b/config index 0a884d07..dc721415 100755 --- a/config +++ b/config @@ -57,13 +57,14 @@ function check_restart { FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then restart=1 - echo "Need to restart" + echo "Need to restart since batt saver" else reboot=1 echo "Need to reboot" fi else restart=1 + echo "Need to restart" fi } @@ -224,17 +225,18 @@ elif [ "$1" = "-a" ]; then else echo "changing CubeSatSim to AFSK mode" + check_restart sudo echo "a" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - restart=1 - else - reboot=1 - fi - else - restart=1 - fi +# if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then +# FILE=/home/pi/CubeSatSim/battery_saver +# if [ -f "$FILE" ]; then +# restart=1 +# else +# reboot=1 +# fi +# else +# restart=1 +# fi fi elif [ "$1" = "-m" ]; then @@ -250,17 +252,18 @@ elif [ "$1" = "-m" ]; then else echo "changing CubeSatSim to CW mode" + check_restart sudo echo "m" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - restart=1 - else - reboot=1 - fi - else - restart=1 - fi +# if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then +# FILE=/home/pi/CubeSatSim/battery_saver +# if [ -f "$FILE" ]; then +# restart=1 +# else +# reboot=1 +# fi +# else +# restart=1 +# fi fi elif [ "$1" = "-f" ]; then @@ -310,18 +313,19 @@ elif [ "$1" = "-s" ]; then else echo "changing CubeSatSim to SSTV mode" + check_restart sudo echo "s" > /home/pi/CubeSatSim/.mode - if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then - - FILE=/home/pi/CubeSatSim/battery_saver - if [ -f "$FILE" ]; then - restart=1 - else - reboot=1 - fi - else - restart=1 - fi +# if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then +# +# FILE=/home/pi/CubeSatSim/battery_saver +# if [ -f "$FILE" ]; then +# restart=1 +# else +# reboot=1 +# fi +# else +# restart=1 +# fi fi elif [ "$1" = "-t" ]; then