From b2c72f766a7bf35ba83ff62b15377f9aaba6cb05 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 1 Jan 2026 17:11:36 -0500 Subject: [PATCH] Update config add check_restart --- config | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/config b/config index 74fb6c7e..a64a7b1c 100755 --- a/config +++ b/config @@ -47,6 +47,21 @@ function transmit_command { exit } +functionn 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 +} + echo "CubeSatSim v2.1 configuration tool" echo # echo $1 @@ -1116,7 +1131,11 @@ elif [ "$1" = "-n" ]; then if [ "$1" = "n" ]; then echo "Turning Transmit Commands mode OFF" - if [ "$new" = "a" ] || [ "$new" = "f" ] || [ "$new" = "b" ] || [ "$new" = "s" ] || [ "$new" = "m" ] || [ "$new" = "e" ] || [ "$new" = "j" ] ; then + if [ "$new" = "a" ] || [ "$new" = "s" ] || [ "$new" = "m" ] ; then + echo "Switching to mode "$new + sudo echo $new > /home/pi/CubeSatSim/.mode + check_restart + elif [ "$new" = "f" ] || [ "$new" = "b" ] || [ "$new" = "e" ] || [ "$new" = "j" ] ; then echo "Switching to mode "$new sudo echo $new > /home/pi/CubeSatSim/.mode restart=1