From 56918cbc152304239b25158cd07c674ddf2b51e7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 09:38:08 -0400 Subject: [PATCH 01/54] Update main.h added FAIL_UNPLUG --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 6ce6b86a..4c83b32a 100644 --- a/main.h +++ b/main.h @@ -123,6 +123,7 @@ FILE *image_file; #define FAIL_COUNT 10 #define FAIL_NONE -1 +#define FAIL_UNPLUG 0 #define FAIL_SOLAR 1 #define FAIL_DEGRADE 2 #define FAIL_SHORT 3 From 8d1c26dbd7879096fb430104ad0a13c9d81789c3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 09:40:16 -0400 Subject: [PATCH 02/54] Update main.c adde FAIL_UNPLUG --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index 2c705223..85849e2b 100644 --- a/main.c +++ b/main.c @@ -1254,6 +1254,11 @@ void get_tlm_fox() { // failureMode = (int) rnd_float(1, FAIL_COUNT); // printf("Random Failure\n"); // } + if (failureMode == FAIL_UNPLUG) { + voltage[map[PLUS_X]] = rnd_float(0.8, 0.95); + current[map[PLUS_X]] = 0.0; + printf("+X Solar Unplugged Failure\n"); + } if (failureMode == FAIL_SOLAR) { voltage[map[PLUS_X]] = 0.0; current[map[PLUS_X]] = 0.0; From bd3196ff96ee3c40ac12bd1a8e8af40dde312cb4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 09:46:01 -0400 Subject: [PATCH 03/54] Update config added FAIL_UNPLUG --- config | 79 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/config b/config index ab01910e..e2b5da93 100755 --- a/config +++ b/config @@ -292,37 +292,40 @@ if [ "$1" = "" ]; then # cat $FILE case $fail in - + 1) + echo "+X Solar Panel Unplugged" + ;; + 2) echo "+X Solar Panel Failure" ;; - 2) + 3) echo "-X Solar Panel Degredation" ;; - 3) + 4) echo "-Y Solar Panel Short Circuit" ;; - 4) + 5) echo "Failed I2C Bus 1" ;; - 5) + 6) echo "Failed I2C Bus 3" ;; - 6) + 7) echo "Failed Camera" ;; - 7) + 8) echo "Failed Payload" ;; - 8) + 9) echo "Failed BME Sensor" ;; - 9) + 10) echo "Failed MPU Sensor" ;; -# "10") -# echo "Failed FM Audio" -# ;; + "11") + echo "Failed FM Audio" + ;; *) echo "Unknown Failure" ;; @@ -1503,37 +1506,40 @@ elif [ "$1" = "-M" ]; then fail=$(<$FILE) echo -n "Currently, simulated " case $fail in - + 1) + echo "+X Solar Panel Unplugged" + ;; + 2) echo "+X Solar Panel Failure" ;; - 2) + 3) echo "-X Solar Panel Degredation" ;; - 3) + 4) echo "-Y Solar Panel Short Circuit" ;; - 4) + 5) echo "Failed I2C Bus 1" ;; - 5) + 6) echo "Failed I2C Bus 3" ;; - 6) + 7) echo "Failed Camera" ;; - 7) + 8) echo "Failed Payload" ;; - 8) + 9) echo "Failed BME Sensor" ;; - 9) + "10") echo "Failed MPU Sensor" ;; - # "10") - # echo "Failed FM Audio" - # ;; + "11") + echo "Failed FM Audio" + ;; *) echo "Unknown Failure" ;; @@ -1548,20 +1554,21 @@ elif [ "$1" = "-M" ]; then echo echo " 0 No Failure (turn OFF)" - echo " 1 +X Solar Panel Failure" - echo " 2 -X Solar Panel Degredation" - echo " 3 -Y Solar Panel Short Circuit" - echo " 4 Failed I2C Bus 1" - echo " 5 Failed I2C Bus 3" - echo " 6 Failed Camera" - echo " 7 Failed Payload" - echo " 8 Failed BME Sensor" - echo " 9 Failed MPU Sensor" - # echo "10 Failed FM Audio" + echo " 1 +Z Solar Panel Unplugged" + echo " 2 +X Solar Panel Failure" + echo " 3 -X Solar Panel Degredation" + echo " 4 -Y Solar Panel Short Circuit" + echo " 5 Failed I2C Bus 1" + echo " 6 Failed I2C Bus 3" + echo " 7 Failed Camera" + echo " 8 Failed Payload" + echo " 9 Failed BME Sensor" + echo "10 Failed MPU Sensor" + echo "11 Failed FM Audio" echo - # echo "Enter the failure number to set: 0 - 10" # 10 sometimes gets stuck on carrier - echo "Enter the failure number to set: 0 - 9" + echo "Enter the failure number to set: 0 - 11" + # echo "Enter the failure number to set: 0 - 9" read MODE echo fi From 0d2ed9ed7e670101f13de7166ff6135c7d92cc76 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 09:47:02 -0400 Subject: [PATCH 04/54] Update main.h update fail numbers --- main.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main.h b/main.h index 4c83b32a..bb7f25aa 100644 --- a/main.h +++ b/main.h @@ -121,19 +121,19 @@ FILE *image_file; #define REPEATER 7 #define TXCOMMAND 12 -#define FAIL_COUNT 10 +#define FAIL_COUNT 11 #define FAIL_NONE -1 -#define FAIL_UNPLUG 0 -#define FAIL_SOLAR 1 -#define FAIL_DEGRADE 2 -#define FAIL_SHORT 3 -#define FAIL_I2C1 4 -#define FAIL_I2C3 5 -#define FAIL_CAMERA 6 -#define FAIL_PAYLOAD 7 +#define FAIL_UNPLUG 1 +#define FAIL_SOLAR 2 +#define FAIL_DEGRADE 3 +#define FAIL_SHORT 4 +#define FAIL_I2C1 5 +#define FAIL_I2C3 6 +#define FAIL_CAMERA 7 +#define FAIL_PAYLOAD 8 #define FAIL_BME 8 -#define FAIL_MPU 9 -#define FAIL_AUDIO 10 +#define FAIL_MPU 10 +#define FAIL_AUDIO 11 int failureMode = FAIL_NONE; int transmitStatus = -1; From 5d276d5a22394d41cc513e2d9e6622fe977ab4b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 09:58:53 -0400 Subject: [PATCH 05/54] Update main.c change unplugged to +Y --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 85849e2b..75198f0b 100644 --- a/main.c +++ b/main.c @@ -1255,9 +1255,9 @@ void get_tlm_fox() { // printf("Random Failure\n"); // } if (failureMode == FAIL_UNPLUG) { - voltage[map[PLUS_X]] = rnd_float(0.8, 0.95); - current[map[PLUS_X]] = 0.0; - printf("+X Solar Unplugged Failure\n"); + voltage[map[PLUS_Y]] = rnd_float(0.8, 0.95); + current[map[PLUS_Y]] = 0.0; + printf("+Y Solar Unplugged Failure\n"); } if (failureMode == FAIL_SOLAR) { voltage[map[PLUS_X]] = 0.0; From 370b5c717767b4444f91c2367f2688125d51456d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 10:00:55 -0400 Subject: [PATCH 06/54] Update config with +Y unplugged --- config | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/config b/config index e2b5da93..c62f4be8 100755 --- a/config +++ b/config @@ -294,7 +294,7 @@ if [ "$1" = "" ]; then case $fail in 1) - echo "+X Solar Panel Unplugged" + echo "+Y Solar Panel Unplugged" ;; 2) echo "+X Solar Panel Failure" @@ -1508,7 +1508,7 @@ elif [ "$1" = "-M" ]; then case $fail in 1) - echo "+X Solar Panel Unplugged" + echo "+Y Solar Panel Unplugged" ;; 2) echo "+X Solar Panel Failure" @@ -1554,7 +1554,7 @@ elif [ "$1" = "-M" ]; then echo echo " 0 No Failure (turn OFF)" - echo " 1 +Z Solar Panel Unplugged" + echo " 1 +Y Solar Panel Unplugged" echo " 2 +X Solar Panel Failure" echo " 3 -X Solar Panel Degredation" echo " 4 -Y Solar Panel Short Circuit" @@ -1578,37 +1578,39 @@ elif [ "$1" = "-M" ]; then MODE=-1 else case $MODE in - 1) + echo "+Y Solar Panel Unplugged" + ;; + 2) echo "Setting Simulated +X Solar Panel Failure" ;; - 2) + 3) echo "Setting Simulated -X Solar Panel Degredation" ;; - 3) + 4) echo "Setting Simulated -Y Solar Panel Short Circuit" ;; - 4) + 5) echo "Setting Simulated Failed I2C Bus 1" ;; - 5) + 6) echo "Setting Simulated Failed I2C Bus 3" ;; - 6) + 7) echo "Setting Simulated Failed Camera" ;; - 7) + 8) echo "Setting Simulated Failed Payload" ;; - 8) + 9) echo "Setting Simulated Failed BME Sensor" ;; - 9) + "10") echo "Setting Simulated Failed MPU Sensor" ;; -# "10") -# echo "Setting Failed FM Audio" -# ;; + "11") + echo "Setting Failed FM Audio" + ;; *) echo "Setting No Simulated Failure" MODE=-1 From 95040ec2beb34695e0175f15c3b4d15290288c2f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 10:01:35 -0400 Subject: [PATCH 07/54] Update update changed to v2.2 --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index 7c38b361..f5477ccd 100755 --- a/update +++ b/update @@ -1,6 +1,6 @@ #!/bin/bash -echo -e "\nupdate script for CubeSatSim v2.1\n" +echo -e "\nupdate script for CubeSatSim v2.2\n" FLAG=0 checkout=0 From 97165bbbea757cabf9803afeb74c235704871f9b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 10:13:06 -0400 Subject: [PATCH 08/54] Update main.c add secondTime --- main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 75198f0b..80fae692 100644 --- a/main.c +++ b/main.c @@ -496,8 +496,11 @@ int main(int argc, char * argv[]) { get_tlm_fox(); // fill transmit buffer with reset count 0 packets that will be ignored else if (((mode == FC))) // && !sim_mode) get_tlm_fc(); // fill transmit buffer with reset count 0 packets that will be ignored - - firstTime = 1; + + if (firstTime == 0) + firstTime = 1; + if (firsTime == 1) && (secondTime == 0) + secondTime = 1; // if (!sim_mode) // always read sensors, even in sim mode { @@ -1312,7 +1315,7 @@ void get_tlm_fox() { // for (int frames = 0; frames < FRAME_CNT; frames++) for (int frames = 0; frames < frameCnt; frames++) { - if (firstTime != ON) { + if ((firstTime != ON) && (second_time != ON)) { // delay for sample period /**/ @@ -1330,7 +1333,7 @@ void get_tlm_fox() { sampleTime = (unsigned int) millis(); } else - printf("first time - no sleep\n"); + printf("first or second time - no sleep\n"); printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); fflush(stdout); @@ -2781,4 +2784,5 @@ void socket_send(int length) { if (socket_open == 1) firstTime = 0; + secondTime = 0; } From f718a98d9234b1da3353e70b300aa34cbb23844b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 10:13:40 -0400 Subject: [PATCH 09/54] Update main.h add secondTime --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index bb7f25aa..8bece91e 100644 --- a/main.h +++ b/main.h @@ -98,6 +98,7 @@ int socket_open = 0; int sock = 0; int loop = -1, loop_count = 0; int firstTime = ON; // 0; +int secondTime = ON; long start; int testCount = 0; long time_start; From 3942d0e181af619bf2bdc8489c7f07a28a411748 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 10:17:04 -0400 Subject: [PATCH 10/54] Update main.c typos --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 80fae692..9d9ebd50 100644 --- a/main.c +++ b/main.c @@ -499,7 +499,7 @@ int main(int argc, char * argv[]) { if (firstTime == 0) firstTime = 1; - if (firsTime == 1) && (secondTime == 0) + if ((firstTime == 1) && (secondTime == 0)) secondTime = 1; // if (!sim_mode) // always read sensors, even in sim mode From 4def42b1b44cc19c663d6209b421877eb1ee7302 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 10:19:19 -0400 Subject: [PATCH 11/54] Update main.c another typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 9d9ebd50..eb96f13b 100644 --- a/main.c +++ b/main.c @@ -1315,7 +1315,7 @@ void get_tlm_fox() { // for (int frames = 0; frames < FRAME_CNT; frames++) for (int frames = 0; frames < frameCnt; frames++) { - if ((firstTime != ON) && (second_time != ON)) { + if ((firstTime != ON) && (secondTime != ON)) { // delay for sample period /**/ From b56684f3d60f058f2df4f9f473d2d1e1add50fcd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 14:52:04 -0400 Subject: [PATCH 12/54] Update main.c remove secondTime and short sleep on first time --- main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index eb96f13b..a6941782 100644 --- a/main.c +++ b/main.c @@ -499,8 +499,6 @@ int main(int argc, char * argv[]) { if (firstTime == 0) firstTime = 1; - if ((firstTime == 1) && (secondTime == 0)) - secondTime = 1; // if (!sim_mode) // always read sensors, even in sim mode { @@ -1315,7 +1313,8 @@ void get_tlm_fox() { // for (int frames = 0; frames < FRAME_CNT; frames++) for (int frames = 0; frames < frameCnt; frames++) { - if ((firstTime != ON) && (secondTime != ON)) { +// if (firstTime != ON) { + if (true) { // delay for sample period /**/ @@ -2784,5 +2783,4 @@ void socket_send(int length) { if (socket_open == 1) firstTime = 0; - secondTime = 0; } From c3a25e579e22fa042e52f9197009e52203aedb5a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 14:53:40 -0400 Subject: [PATCH 13/54] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index a6941782..3d03d5dc 100644 --- a/main.c +++ b/main.c @@ -1314,7 +1314,7 @@ void get_tlm_fox() { for (int frames = 0; frames < frameCnt; frames++) { // if (firstTime != ON) { - if (true) { + if (TRUE) { // delay for sample period /**/ From 6ff74af6d47e116f90c4298f309f38bc787edae2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:16:44 -0400 Subject: [PATCH 14/54] Update config with -N next mode --- config | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/config b/config index c62f4be8..5a328b00 100755 --- a/config +++ b/config @@ -1622,6 +1622,46 @@ elif [ "$1" = "-M" ]; then echo echo $MODE > /home/pi/CubeSatSim/failure_mode.txt +elif [ "$1" = "-N" ]; then + + echo "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 + elif [ "$1" = "-h" ]; then echo "config OPTION" @@ -1660,7 +1700,7 @@ elif [ "$1" = "-h" ]; then echo " -L Change microphone level for command and control" echo " -g Reset configuration back to default settings" echo " -M Set simulated failure mode" - + echo " -N Set next mode" echo exit From 282589ddaf154fe58c47652266f4c2803fd8d853 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:39:19 -0400 Subject: [PATCH 15/54] 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 From fae529b59ad407bdae25314a671135c2cdf93952 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:41:14 -0400 Subject: [PATCH 16/54] Update config missing fi --- config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config b/config index 14205483..47a6b3e8 100755 --- a/config +++ b/config @@ -54,7 +54,7 @@ function transmit_command_fsk { echo "Resuming command and control" sudo systemctl start command - else + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=f" sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 @@ -89,7 +89,7 @@ function transmit_command_bpsk { echo "Resuming command and control" sudo systemctl start command - else + STRING="AMSAT-11>APCSS:=3901.40N\07704.39WShi hi MODE=b" sudo rm /home/pi/CubeSatSim/t.txt > /dev/null 2>&1 @@ -1633,6 +1633,7 @@ elif [ "$1" = "-N" ]; then echo "Simulated failure mode" fail=$(<$FILE) echo $fail + fi else echo "No simulated failure" fail=0 From 1c425461c757615b9535d547bb0740f8d03e54ef Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:42:59 -0400 Subject: [PATCH 17/54] Update config missing ; --- config | 78 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/config b/config index 47a6b3e8..3fa49a09 100755 --- a/config +++ b/config @@ -1639,46 +1639,46 @@ elif [ "$1" = "-N" ]; then fail=0 fi - 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 + 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 "Changing to next simulated failure mode" + echo "Unknown mode" + fi + else + echo "Changing to next simulated failure mode" fi elif [ "$1" = "-h" ]; then From 4304b504cb20675f1aa9caa1116ae5339f87af88 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:48:23 -0400 Subject: [PATCH 18/54] Update config increment fail --- config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config b/config index 3fa49a09..cdb98628 100755 --- a/config +++ b/config @@ -1679,6 +1679,9 @@ elif [ "$1" = "-N" ]; then fi else echo "Changing to next simulated failure mode" + fail=$((fail + 1)) + echo $fail + fi elif [ "$1" = "-h" ]; then From 24d0a943713d0689ff33c7565c8df5f3c0465af4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:51:31 -0400 Subject: [PATCH 19/54] Update config add modulo 11 --- config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config b/config index cdb98628..46deac7f 100755 --- a/config +++ b/config @@ -1680,6 +1680,8 @@ elif [ "$1" = "-N" ]; then else echo "Changing to next simulated failure mode" fail=$((fail + 1)) + if [ $fail == 12 ]; then + fail=1 echo $fail fi From e91b6ebac1d4cd100f333c75934774cc0c3fa116 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:52:21 -0400 Subject: [PATCH 20/54] Update config missing fi --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 46deac7f..731ddb53 100755 --- a/config +++ b/config @@ -1682,6 +1682,7 @@ elif [ "$1" = "-N" ]; then fail=$((fail + 1)) if [ $fail == 12 ]; then fail=1 + fi echo $fail fi From 201c2d9cb3fdcdf823e01b66689dee80ff50c0a9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:53:15 -0400 Subject: [PATCH 21/54] Update config change fail mode on -N --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 731ddb53..3c0edf0a 100755 --- a/config +++ b/config @@ -1684,6 +1684,7 @@ elif [ "$1" = "-N" ]; then fail=1 fi echo $fail + /home/pi/CubeSatSim/config -M $fail fi From cb458aeea0cd351fc26208feb755d86cc0dfc1ca Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 15:58:24 -0400 Subject: [PATCH 22/54] Update update add pi-power-button next branch --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index f5477ccd..e183c797 100755 --- a/update +++ b/update @@ -297,7 +297,7 @@ cd /home/pi/pi-power-button echo "updating pi-power-button." -# git checkout master + git checkout next # new next branch script/install From 178d3c5d3691dc5d301f9315e9deab01fe96cb01 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 16:01:43 -0400 Subject: [PATCH 23/54] Update update force pi-power-button to update --- update | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/update b/update index e183c797..2f72c779 100755 --- a/update +++ b/update @@ -288,24 +288,22 @@ fi cd /home/pi/pi-power-button - git checkout master - git pull --no-rebase > .updated_p - grep 'changed' /home/pi/pi-power-button/.updated_p - if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then + git checkout next + +# grep 'changed' /home/pi/pi-power-button/.updated_p +# if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then echo "updating pi-power-button." - - git checkout next # new next branch script/install FLAG=1 - else - echo "nothing to do for pi-power-button." - fi + # else + # echo "nothing to do for pi-power-button." + # fi cd /home/pi/ssdv From 5191fcd5f3fc7f08c4ad6bb7c4bc922ca684d623 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:34:25 -0400 Subject: [PATCH 24/54] Update main.h added fail_yes and fail_time --- main.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.h b/main.h index 8bece91e..0f0a1f6b 100644 --- a/main.h +++ b/main.h @@ -161,6 +161,8 @@ long int uptime; char call[5]; char sim_yes[10]; char hab_yes[10]; +char fail_yes[10]; +int fail_time = 60; int squelch = 3; // default squelch char rx[12], tx[12]; int tx_pl = 0; From 4a8671f43c0e5daf0cfb1fb4675d748f8fb93cee Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:36:57 -0400 Subject: [PATCH 25/54] Update main.h add fail_rnd_mode --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 0f0a1f6b..d7adf62e 100644 --- a/main.h +++ b/main.h @@ -227,6 +227,7 @@ int pi_zero_2_offset = 0; int hab_mode = FALSE; +int fail_rnd_mode = FALSE; int battery_saver_mode = FALSE; long int loopTime; From 1f8c04e221e1fc5b1ff794828f3ed3c5db323bc7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:40:44 -0400 Subject: [PATCH 26/54] Update main.h added failTime --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index d7adf62e..0f990ea5 100644 --- a/main.h +++ b/main.h @@ -230,6 +230,7 @@ int hab_mode = FALSE; int fail_rnd_mode = FALSE; int battery_saver_mode = FALSE; long int loopTime; +long int failTime = 0; int error_count = 0; int groundCommandCount = 0; From 81d844266f1c829816a32f3f809083ced337e891 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:41:37 -0400 Subject: [PATCH 27/54] Update main.c added random sim fail to sim.cfg --- main.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 3d03d5dc..49e917b8 100644 --- a/main.c +++ b/main.c @@ -41,11 +41,11 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d", - call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes, & rx_pl, & tx_pl); + fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d %s %d", + call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, fail_yes, &fail_time); fclose(config_file); - fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d\n", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); + fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %d\n", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); fprintf(stderr, "Transmit on %s MHz Receive on %s MHz\n", tx, rx); @@ -86,6 +86,10 @@ int main(int argc, char * argv[]) { hab_mode = TRUE; fprintf(stderr, "HAB mode is ON\n"); } + if (strcmp(fail_yes, "yes") == 0) { + fail_rnd_mode = TRUE; + fprintf(stderr, "Random fail mode is ON\n"); + } FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r"); if (command_file == NULL) { @@ -289,7 +293,8 @@ int main(int argc, char * argv[]) { } config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %s %d", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); @@ -554,14 +559,16 @@ int main(int argc, char * argv[]) { // #endif fclose(uptime_file); - if (sim_mode) { - if (loop % 10 == 0) { + if (fail_rnd_mode) { +// if (loop % 10 == 0) { + if ((loopTime - failTime) > fail_time * 1000) { // failureMode = (int) rnd_float(1, FAIL_COUNT); failureMode = (int) rnd_float(1, 9); printf("Sim Mode Random Failure Change\n"); FILE * failure_mode_file = fopen("/home/pi/CubeSatSim/failure_mode.txt", "w"); fprintf(failure_mode_file, "%d", failureMode); - fclose(failure_mode_file); + fclose(failure_mode_file); + failTime = loopTime; } } // else From dc29ecab0cf3474d58b7a06e79c868f4858ccb4b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:49:13 -0400 Subject: [PATCH 28/54] Update config add random fail mode --- config | 57 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/config b/config index 3c0edf0a..605fdedd 100755 --- a/config +++ b/config @@ -335,7 +335,12 @@ if [ "$1" = "" ]; then else echo "No simulated failure" fi -# echo + + if [ "${12}" = "y" ] || [ "${12}" = "yes" ] ; then + echo "Random Failure Mode is ON" + else + echo "Random Failure Mode is OFF" + fi if [ "$9" = "yes" ] || [ "$9" = "y" ]; then echo "Balloon mode is ON" @@ -401,7 +406,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo echo "To change, include an OPTION" @@ -547,7 +552,7 @@ elif [ "$1" = "-t" ]; then echo -# $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} +# $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} echo "Do you want Simulated Telemetry ON (y/n) " read sim @@ -565,8 +570,8 @@ elif [ "$1" = "-t" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} - echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} ${12} ${13} + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo @@ -593,7 +598,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} echo "Enter callsign in all capitals: " read callsign @@ -607,8 +612,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} - echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -641,7 +646,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo -e "Enter Reset Count (integer): " @@ -661,8 +666,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + 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 @@ -696,7 +701,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo -e "Enter latitude (decimal degrees, positive is north): " @@ -738,8 +743,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} - echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} + echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -1031,7 +1036,7 @@ elif [ "$1" = "-q" ]; then echo $6 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo -e "Enter squelch (integer 1 - 8): " @@ -1053,8 +1058,8 @@ elif [ "$1" = "-q" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $sq $7 $8 $9 ${10} ${11} - echo $1 $2 $3 $4 $4 $sq $7 $8 $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $sq $7 $8 $9 ${10} ${11} ${12} ${13} + echo $1 $2 $3 $4 $4 $sq $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg echo echo "Restarting CubeSatSim with new configuration file" ## echo @@ -1090,7 +1095,7 @@ elif [ "$1" = "-P" ]; then echo ${11} echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo -e "Enter RX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)" @@ -1133,8 +1138,8 @@ elif [ "$1" = "-P" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl ${12} ${13} + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl ${12} ${13} > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo @@ -1164,7 +1169,7 @@ elif [ "$1" = "-F" ]; then echo $8 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo "Enter tx frequency as 4XX.XXXX: " read tx @@ -1187,8 +1192,8 @@ elif [ "$1" = "-F" ]; then echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" - echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} - echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} ${12} ${13} + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg # fi # if [ "$norestart" = "1" ]; then @@ -1270,7 +1275,7 @@ elif [ "$1" = "-H" ]; then echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} echo "Do you want Balloon mode ON (y/n) " read hab @@ -1287,8 +1292,8 @@ elif [ "$1" = "-H" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} - echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} ${12} ${13} + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo From 1e90684751da5e7808839da09b454c3b953f3f4b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:52:35 -0400 Subject: [PATCH 29/54] Update main.c default fail_rnd to no --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 49e917b8..13187c81 100644 --- a/main.c +++ b/main.c @@ -292,6 +292,7 @@ int main(int argc, char * argv[]) { transmit = TRUE; } + strcpy(fail_yes, "no"); config_file = fopen("sim.cfg", "w"); fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %s %d", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); From 370f65ce830249780bffa9ac34c35d8a1e7ef8f2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:57:02 -0400 Subject: [PATCH 30/54] Update main.c swap order --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 13187c81..4fe621ad 100644 --- a/main.c +++ b/main.c @@ -42,10 +42,10 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d %s %d", - call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, fail_yes, &fail_time); + call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, &fail_time, fail_yes); fclose(config_file); - fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %d\n", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); + fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %s\n", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_time, fail_yes); fprintf(stderr, "Transmit on %s MHz Receive on %s MHz\n", tx, rx); @@ -294,8 +294,8 @@ int main(int argc, char * argv[]) { strcpy(fail_yes, "no"); config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %s %d", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %d %s", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_time, fail_yes); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From a48df136345ce1995a6f9123cd6ea5ae6fc55a0c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 17:58:58 -0400 Subject: [PATCH 31/54] Update main.c revert --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 4fe621ad..13187c81 100644 --- a/main.c +++ b/main.c @@ -42,10 +42,10 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d %s %d", - call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, &fail_time, fail_yes); + call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, fail_yes, &fail_time); fclose(config_file); - fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %s\n", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_time, fail_yes); + fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %d\n", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); fprintf(stderr, "Transmit on %s MHz Receive on %s MHz\n", tx, rx); @@ -294,8 +294,8 @@ int main(int argc, char * argv[]) { strcpy(fail_yes, "no"); config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %d %s", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_time, fail_yes); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %s %d", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From e9d8472804f608c5f5c351575b10ac27f81803ac Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:11:34 -0400 Subject: [PATCH 33/54] Update main.c move default no --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 13187c81..be581eda 100644 --- a/main.c +++ b/main.c @@ -28,7 +28,8 @@ int main(int argc, char * argv[]) { printf("\n\nCubeSatSim v2.2 starting...\n\n"); wiringPiSetup(); - + + strcpy(fail_yes, "no"); // Open configuration file with callsign and reset count FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r"); if (config_file == NULL) { @@ -292,7 +293,6 @@ int main(int argc, char * argv[]) { transmit = TRUE; } - strcpy(fail_yes, "no"); config_file = fopen("sim.cfg", "w"); fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %s %d", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time); From a00b92cd01933f5cbe43357e580f9548dbe1346d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:27:24 -0400 Subject: [PATCH 34/54] 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) From 0d7e41b8f19ab0a5bbfac4f74148266d28b7bdbe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:28:21 -0400 Subject: [PATCH 35/54] Update config fix elif --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index f6dda702..1f75bffa 100755 --- a/config +++ b/config @@ -1582,7 +1582,7 @@ elif [ "$1" = "-M" ]; then if [ "$MODE" = "0" ]; then echo "Setting No Simulated Failure" MODE=-1 - elseif [ "$MODE" = "12" ]; then + elif [ "$MODE" = "12" ]; then echo "Setting Random Simulated Failure" echo From d4b29ca3aeae584ab71b1aea2cc94c6211530882 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:29:39 -0400 Subject: [PATCH 36/54] Update config save time --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 1f75bffa..9749b28d 100755 --- a/config +++ b/config @@ -1595,7 +1595,7 @@ elif [ "$1" = "-M" ]; then set -- $value echo - echo -n "Current value in seconds is" + echo -n "Current value in seconds is " echo ${13} echo @@ -1619,8 +1619,8 @@ elif [ "$1" = "-M" ]; then 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 + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} $time + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} $time > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then From ac71bf2f914c2f892dba7d46e96a69ce85a448b3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:40:13 -0400 Subject: [PATCH 37/54] Update install added check for Bullseye --- install | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/install b/install index 3de142d4..b026c78e 100755 --- a/install +++ b/install @@ -2,6 +2,17 @@ echo -e "\ninstallation script for CubeSatSim v2.2\n" +cat | grep "11." + + if [[ $(grep '11.' /etc/debian_version) ]]; then + echo "Installing on Debian 11 (Bullseye)" + else + echo "This is not Debian 11 (Bullseye)!" + echo "Installation is not likely to work." + echo "Recommend you start with a Bullseye." + sleep 10 + fi + FILE=/home/pi/CubeSatSim/sim.cfg if [ -f "$FILE" ]; then echo "$FILE exists." From 14e6c3e0411206a6c7bf269c4037960b9978d359 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 16 Aug 2025 18:41:44 -0400 Subject: [PATCH 38/54] Update install OS version check --- install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install b/install index b026c78e..2e590c3c 100755 --- a/install +++ b/install @@ -2,14 +2,13 @@ echo -e "\ninstallation script for CubeSatSim v2.2\n" -cat | grep "11." - if [[ $(grep '11.' /etc/debian_version) ]]; then echo "Installing on Debian 11 (Bullseye)" else echo "This is not Debian 11 (Bullseye)!" echo "Installation is not likely to work." echo "Recommend you start with a Bullseye." + echo sleep 10 fi From 6bebfdf42cf5f6cc60528c2456cbbdedb7577739 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:01:33 -0400 Subject: [PATCH 39/54] Update transmit.py fix no fail mode --- transmit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transmit.py b/transmit.py index fc745f45..44c8a107 100644 --- a/transmit.py +++ b/transmit.py @@ -27,7 +27,7 @@ def sim_failure_check(): elif (fail_mode == 6): cam_fail = True print("Failure mode camera fail") - elif (fail_mode == 0): + elif (fail_mode == -1): print("No failure mode") else: print("Other failure mode") From e7e965d7a1a817fbcd85442748088578756adcef Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:04:41 -0400 Subject: [PATCH 40/54] Update config add wall --- config | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config b/config index 9749b28d..10d6989c 100755 --- a/config +++ b/config @@ -1629,10 +1629,6 @@ elif [ "$1" = "-M" ]; then reboot=1 fi - - - - else case $MODE in 1) @@ -1679,6 +1675,9 @@ elif [ "$1" = "-M" ]; then echo echo $MODE > /home/pi/CubeSatSim/failure_mode.txt + echo 'Changing simulated failure mode to $MODE' | wall + + elif [ "$1" = "-N" ]; then FILE=/home/pi/CubeSatSim/failure_mode.txt From e28708ab7dbdab6f071aaa9af1142b0fa6920e14 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:07:05 -0400 Subject: [PATCH 41/54] Update config wall mode --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 10d6989c..750d83fd 100755 --- a/config +++ b/config @@ -1675,7 +1675,7 @@ elif [ "$1" = "-M" ]; then echo echo $MODE > /home/pi/CubeSatSim/failure_mode.txt - echo 'Changing simulated failure mode to $MODE' | wall + echo 'Changing simulated failure mode to " $MODE | wall elif [ "$1" = "-N" ]; then From 465e3cd3f880bb39c24cf05dfbead1f977b035db Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:08:36 -0400 Subject: [PATCH 42/54] Update config fix wall --- config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config b/config index 750d83fd..f488be66 100755 --- a/config +++ b/config @@ -1675,7 +1675,8 @@ elif [ "$1" = "-M" ]; then echo echo $MODE > /home/pi/CubeSatSim/failure_mode.txt - echo 'Changing simulated failure mode to " $MODE | wall + echo -n "Changing simulated failure mode to " | wall + echo $MODE | wall elif [ "$1" = "-N" ]; then From 01770f5fd4cc4ec3b1d6f2d9bcc0d2221e6e1616 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:10:12 -0400 Subject: [PATCH 43/54] Update config include mode in wall msg --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index f488be66..8e2cb934 100755 --- a/config +++ b/config @@ -1675,8 +1675,8 @@ elif [ "$1" = "-M" ]; then echo echo $MODE > /home/pi/CubeSatSim/failure_mode.txt - echo -n "Changing simulated failure mode to " | wall - echo $MODE | wall + echo "Changing simulated failure mode to $MODE" | wall + elif [ "$1" = "-N" ]; then From a08222f7ea61cf4de483f577069ac80e58face40 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:24:00 -0400 Subject: [PATCH 44/54] Update config add -U to change random sim failure on off --- config | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/config b/config index 8e2cb934..15e9ea4d 100755 --- a/config +++ b/config @@ -1745,6 +1745,55 @@ elif [ "$1" = "-N" ]; then fi +elif [ "$1" = "-U" ]; then + + echo + echo "Changing the Random Simulated Failure setting in" + echo "the configuration file for CubeSatSim" + echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + if [ "${12}" = "yes" ] || [ "${12}" = "y" ]; then + echo "Random Simulated Failure is ON" + else + echo "Random Simulated Failure is OFF" + fi + + echo + +# $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} + + echo "Do you want Random Simulated Failure ON (y/n) " + read sim + echo + + if [ "$sim" = "y" ] || [ "$sim" = "yes" ] ; then + sim="yes" + echo "Random Simulated Failure is ON" + else + sim="no" + echo "Random Simulated Failure is OFF" +# echo "-1" > /home/pi/CubeSatSim/failure_mode.txt # make sure to turn off any simulated failures + fi + +# echo + echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" +# echo + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim ${13} + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim ${13} > /home/pi/CubeSatSim/sim.cfg + echo +## echo "Rebooting CubeSatSim with new configuration file" +## echo + + reboot=1 +## sudo reboot now +# sudo restart cubesatsim + + + elif [ "$1" = "-h" ]; then echo "config OPTION" @@ -1783,7 +1832,8 @@ elif [ "$1" = "-h" ]; then echo " -L Change microphone level for command and control" echo " -g Reset configuration back to default settings" echo " -M Set simulated failure mode" - echo " -N Set next mode" + echo " -U Change the random failure mode setting" + echo " -N Set next mode or failure" echo exit From 93234b58438f83a44a5baec8f48aff65b2f0b62b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 09:56:41 -0400 Subject: [PATCH 45/54] Update config move random time to -U --- config | 75 ++++++++++++++++++++++------------------------------------ 1 file changed, 28 insertions(+), 47 deletions(-) diff --git a/config b/config index 15e9ea4d..f2600b5b 100755 --- a/config +++ b/config @@ -1582,52 +1582,13 @@ elif [ "$1" = "-M" ]; then if [ "$MODE" = "0" ]; then echo "Setting No Simulated Failure" MODE=-1 - elif [ "$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} $time - echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} $time > /home/pi/CubeSatSim/sim.cfg - fi +# elif [ "$MODE" = "12" ]; then - if [ "$norestart" = "1" ]; then - echo - else - reboot=1 - fi +# if [ "$norestart" = "1" ]; then +# echo +# else +# reboot=1 +# fi else case $MODE in @@ -1773,6 +1734,26 @@ elif [ "$1" = "-U" ]; then if [ "$sim" = "y" ] || [ "$sim" = "yes" ] ; then sim="yes" echo "Random Simulated Failure is ON" + echo + echo "A new random failure is selected every" + echo ${13} " seconds." + echo + echo "Enter a new value or Return keeps current value." + + echo "Enter time in seconds (integer): " + + read time + + if [ -z $time ] ; then + time="${13}" + echo "Keeping value of " $time " seconds" + fi + + if ! [[ $time =~ ^[0-9]+$ ]] ; then + echo "Error: not an integer!" + time="${13}" + echo "Keeping value of" $time +# norestart=1 else sim="no" echo "Random Simulated Failure is OFF" @@ -1782,8 +1763,8 @@ elif [ "$1" = "-U" ]; then # echo echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n" # echo - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim ${13} - echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim ${13} > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time > /home/pi/CubeSatSim/sim.cfg echo ## echo "Rebooting CubeSatSim with new configuration file" ## echo From 31eaf7d360d30a72dbbe7fbb30c53398183a88d5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:02:17 -0400 Subject: [PATCH 46/54] Update config change to .gt --- config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config b/config index f2600b5b..c957f88a 100755 --- a/config +++ b/config @@ -1570,10 +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 "12 Random Failure" echo - echo "Enter the failure number to set: 0 - 12" + echo "Enter the failure number to set: 0 - 11" # echo "Enter the failure number to set: 0 - 9" read MODE echo @@ -1698,7 +1698,8 @@ elif [ "$1" = "-N" ]; then else echo "Changing to next simulated failure mode" fail=$((fail + 1)) - if [ $fail == 12 ]; then +# if [ $fail == 12 ]; then + if [ "$fail" -ge "11" ]; then fail=1 fi echo $fail From f3dee164e98dfc426b731e719d1ee3e5ea949811 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:04:00 -0400 Subject: [PATCH 47/54] Update config missing fi --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index c957f88a..157cfda5 100755 --- a/config +++ b/config @@ -1755,6 +1755,8 @@ elif [ "$1" = "-U" ]; then time="${13}" echo "Keeping value of" $time # norestart=1 + fi + else sim="no" echo "Random Simulated Failure is OFF" @@ -1774,8 +1776,6 @@ elif [ "$1" = "-U" ]; then ## sudo reboot now # sudo restart cubesatsim - - elif [ "$1" = "-h" ]; then echo "config OPTION" From b3c1ebee9ece58c2f8a486d0bb5ef7295b30f830 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:09:42 -0400 Subject: [PATCH 48/54] Update config -U only reboot if changed --- config | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/config b/config index 157cfda5..1eac704d 100755 --- a/config +++ b/config @@ -1769,12 +1769,10 @@ elif [ "$1" = "-U" ]; then echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time > /home/pi/CubeSatSim/sim.cfg echo -## echo "Rebooting CubeSatSim with new configuration file" -## echo - reboot=1 -## sudo reboot now -# sudo restart cubesatsim + if [ "${12}" != "$sim" ]; then + reboot=1 + fi elif [ "$1" = "-h" ]; then From 2c7c3315908095566a240ed40f56e5ebd2b08c0b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:13:42 -0400 Subject: [PATCH 49/54] Update config reboot if fail seconds changed --- config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config b/config index 1eac704d..9cca4e40 100755 --- a/config +++ b/config @@ -1754,7 +1754,6 @@ elif [ "$1" = "-U" ]; then echo "Error: not an integer!" time="${13}" echo "Keeping value of" $time -# norestart=1 fi else @@ -1770,7 +1769,7 @@ elif [ "$1" = "-U" ]; then echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time > /home/pi/CubeSatSim/sim.cfg echo - if [ "${12}" != "$sim" ]; then + if [ "${12}" != "$sim" ] || [ "${13}" != "$time" ] ; then reboot=1 fi From 883c5a891ab43e243460b02e951847a9c3d1daed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:33:09 -0400 Subject: [PATCH 50/54] Update config keep time if random off --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 9cca4e40..739f28ae 100755 --- a/config +++ b/config @@ -1759,6 +1759,7 @@ elif [ "$1" = "-U" ]; then else sim="no" echo "Random Simulated Failure is OFF" + time="${13}" # echo "-1" > /home/pi/CubeSatSim/failure_mode.txt # make sure to turn off any simulated failures fi From 274586971a5ec565ea485f23014b92a857e865ba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:47:28 -0400 Subject: [PATCH 51/54] Update config change to gt --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 739f28ae..b73a91db 100755 --- a/config +++ b/config @@ -1699,7 +1699,7 @@ elif [ "$1" = "-N" ]; then echo "Changing to next simulated failure mode" fail=$((fail + 1)) # if [ $fail == 12 ]; then - if [ "$fail" -ge "11" ]; then + if [ "$fail" -gt "11" ]; then fail=1 fi echo $fail From 39055026964de47f36271caa22ebc086dd1fae3d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:55:46 -0400 Subject: [PATCH 52/54] Update config add failure mode number --- config | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/config b/config index b73a91db..115bbc8f 100755 --- a/config +++ b/config @@ -1506,44 +1506,44 @@ elif [ "$1" = "-M" ]; then FILE=/home/pi/CubeSatSim/failure_mode.txt if [ -f "$FILE" ]; then if [[ $(grep "\-1" $FILE) ]]; then - echo "Currently, no simulated failure" + echo "Currently, no simulated failure (0)" else fail=$(<$FILE) echo -n "Currently, simulated " case $fail in 1) - echo "+Y Solar Panel Unplugged" + echo "+Y Solar Panel Unplugged (1)" ;; 2) - echo "+X Solar Panel Failure" + echo "+X Solar Panel Failure (2)" ;; 3) - echo "-X Solar Panel Degredation" + echo "-X Solar Panel Degredation (3)" ;; 4) - echo "-Y Solar Panel Short Circuit" + echo "-Y Solar Panel Short Circuit (4)" ;; 5) - echo "Failed I2C Bus 1" + echo "Failed I2C Bus 1 (5)" ;; 6) - echo "Failed I2C Bus 3" + echo "Failed I2C Bus 3 (6)" ;; 7) - echo "Failed Camera" + echo "Failed Camera (7)" ;; 8) - echo "Failed Payload" + echo "Failed Payload (8)" ;; 9) - echo "Failed BME Sensor" + echo "Failed BME Sensor (9)" ;; "10") - echo "Failed MPU Sensor" + echo "Failed MPU Sensor (10)" ;; "11") - echo "Failed FM Audio" + echo "Failed FM Audio (11)" ;; *) echo "Unknown Failure" @@ -1570,11 +1570,9 @@ 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 - 9" read MODE echo fi From 2a7a7a6016e5e88b4c3bbbbf19159305d9c04b42 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 10:58:50 -0400 Subject: [PATCH 53/54] Update config show failure number and random time period --- config | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/config b/config index 115bbc8f..91f33955 100755 --- a/config +++ b/config @@ -294,37 +294,37 @@ if [ "$1" = "" ]; then case $fail in 1) - echo "+Y Solar Panel Unplugged" + echo "+Y Solar Panel Unplugged (1)" ;; 2) - echo "+X Solar Panel Failure" + echo "+X Solar Panel Failure (2)" ;; 3) - echo "-X Solar Panel Degredation" + echo "-X Solar Panel Degredation (3)" ;; 4) - echo "-Y Solar Panel Short Circuit" + echo "-Y Solar Panel Short Circuit (4)" ;; 5) - echo "Failed I2C Bus 1" + echo "Failed I2C Bus 1 (5)" ;; 6) - echo "Failed I2C Bus 3" + echo "Failed I2C Bus 3 (6)" ;; 7) - echo "Failed Camera" + echo "Failed Camera (7)" ;; 8) - echo "Failed Payload" + echo "Failed Payload (8)" ;; 9) - echo "Failed BME Sensor" + echo "Failed BME Sensor (9)" ;; 10) - echo "Failed MPU Sensor" + echo "Failed MPU Sensor (10)" ;; "11") - echo "Failed FM Audio" + echo "Failed FM Audio (11)" ;; *) echo "Unknown Failure" @@ -337,7 +337,7 @@ if [ "$1" = "" ]; then fi if [ "${12}" = "y" ] || [ "${12}" = "yes" ] ; then - echo "Random Failure Mode is ON" + echo "Random Failure Mode is ON with time period " ${13} " seconds" else echo "Random Failure Mode is OFF" fi From 7de6ef2974b1e485b9ad759cc7bb25d4f9a3a624 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 17 Aug 2025 11:01:44 -0400 Subject: [PATCH 54/54] Update config spacing --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 91f33955..f36c9af8 100755 --- a/config +++ b/config @@ -337,7 +337,7 @@ if [ "$1" = "" ]; then fi if [ "${12}" = "y" ] || [ "${12}" = "yes" ] ; then - echo "Random Failure Mode is ON with time period " ${13} " seconds" + echo "Random Failure Mode is ON with time period" ${13} "seconds" else echo "Random Failure Mode is OFF" fi @@ -1081,7 +1081,7 @@ elif [ "$1" = "-P" ]; then echo echo "Editing the PL (Private Line) CTCSS/CDCSS setting in" - echo "the configuration file for CubeSatSim" + echo "the configuration file for CubeSatSim" echo value=`cat /home/pi/CubeSatSim/sim.cfg` @@ -1735,7 +1735,7 @@ elif [ "$1" = "-U" ]; then echo "Random Simulated Failure is ON" echo echo "A new random failure is selected every" - echo ${13} " seconds." + echo ${13} "seconds." echo echo "Enter a new value or Return keeps current value."