From 282589ddaf154fe58c47652266f4c2803fd8d853 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:39:19 -0400 Subject: [PATCH] Update config -N check for fail mode --- config | 88 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/config b/config index 5a328b00..14205483 100755 --- a/config +++ b/config @@ -1624,42 +1624,60 @@ elif [ "$1" = "-M" ]; then elif [ "$1" = "-N" ]; then - echo "Next mode" - - value=`cat /home/pi/CubeSatSim/.mode` - echo "$value" > /dev/null - set -- $value + FILE=/home/pi/CubeSatSim/failure_mode.txt + if [ -f "$FILE" ]; then + if [[ $(grep "\-1" $FILE) ]]; then + echo "No simulated failure" + fail=0 + else + echo "Simulated failure mode" + fail=$(<$FILE) + echo $fail + else + echo "No simulated failure" + fail=0 + fi - if [ "$1" = "a" ]; then - echo "Current mode is APRS" - echo "Next mode is FSK" - /home/pi/CubeSatSim/config -f - elif [ "$1" = "m" ]; then - echo "Current mode is CW" - echo "Next mode is FunCube" - /home/pi/CubeSatSim/config -j - elif [ "$1" = "f" ]; then - echo "Current mode is FSK" - echo "Next mode is BPSK" - /home/pi/CubeSatSim/config -b - elif [ "$1" = "b" ]; then - echo "Current mode is BPSK" - echo "Next mode is SSTV" - /home/pi/CubeSatSim/config -s - elif [ "$1" = "s" ]; then - echo "Current mode is SSTV" - echo "Next mode is CW" - /home/pi/CubeSatSim/config -m - elif [ "$1" = "e" ]; then - echo "Current mode is Repeater" - echo "Next mode is APRS" - /home/pi/CubeSatSim/config -a - elif [ "$1" = "j" ]; then - echo "Current mode is FUNcube" - echo "Next mode is Repeater" - /home/pi/CubeSatSim/config -e - else - echo "Unknown mode" + if [ $fail == 0 ] then + echo "Changing to next mode" + + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + + if [ "$1" = "a" ]; then + echo "Current mode is APRS" + echo "Next mode is FSK" + /home/pi/CubeSatSim/config -f + elif [ "$1" = "m" ]; then + echo "Current mode is CW" + echo "Next mode is FunCube" + /home/pi/CubeSatSim/config -j + elif [ "$1" = "f" ]; then + echo "Current mode is FSK" + echo "Next mode is BPSK" + /home/pi/CubeSatSim/config -b + elif [ "$1" = "b" ]; then + echo "Current mode is BPSK" + echo "Next mode is SSTV" + /home/pi/CubeSatSim/config -s + elif [ "$1" = "s" ]; then + echo "Current mode is SSTV" + echo "Next mode is CW" + /home/pi/CubeSatSim/config -m + elif [ "$1" = "e" ]; then + echo "Current mode is Repeater" + echo "Next mode is APRS" + /home/pi/CubeSatSim/config -a + elif [ "$1" = "j" ]; then + echo "Current mode is FUNcube" + echo "Next mode is Repeater" + /home/pi/CubeSatSim/config -e + else + echo "Unknown mode" + fi + else + echo "Changing to next simulated failure mode" fi elif [ "$1" = "-h" ]; then