From a00b92cd01933f5cbe43357e580f9548dbe1346d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:27:24 -0400 Subject: [PATCH] Update config set fail rnd time --- config | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/config b/config index 605fdedd..f6dda702 100755 --- a/config +++ b/config @@ -1570,9 +1570,10 @@ elif [ "$1" = "-M" ]; then echo " 9 Failed BME Sensor" echo "10 Failed MPU Sensor" echo "11 Failed FM Audio" + echo "12 Random Failure" echo - echo "Enter the failure number to set: 0 - 11" + echo "Enter the failure number to set: 0 - 12" # echo "Enter the failure number to set: 0 - 9" read MODE echo @@ -1581,6 +1582,57 @@ elif [ "$1" = "-M" ]; then if [ "$MODE" = "0" ]; then echo "Setting No Simulated Failure" MODE=-1 + elseif [ "$MODE" = "12" ]; then + echo "Setting Random Simulated Failure" + + echo + echo "with a new random failure selected in seconds" + echo + echo "Return keeps current value." + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo + echo -n "Current value in seconds is" + echo ${13} + echo + + # echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} + + echo -e "Enter time in seconds (integer): " + + read time + + if [ -z $time ] ; then + time="${13}" + echo "Keeping value of" $time + fi + + if ! [[ $time =~ ^[0-9]+$ ]] ; then + echo "Error: not an integer!" + time="${13}" + echo "Keeping value of" $time + norestart=1 + else + + echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" + + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg + fi + + if [ "$norestart" = "1" ]; then + echo + else + reboot=1 + fi + + + + + else case $MODE in 1)