From 1f048206d6096df4d6c9b533668a79f37402f17d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:08:19 -0500 Subject: [PATCH 01/18] Update main.c make battery saver Safe Mode --- main.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 9958c06f..0ae6eade 100644 --- a/main.c +++ b/main.c @@ -827,13 +827,14 @@ int main(int argc, char * argv[]) { // batteryVoltage = voltage[map[BAT]]; // batteryCurrent = current[map[BAT]]; - + +/* if (batteryVoltage < 3.7) { SafeMode = 1; printf("Safe Mode!\n"); } else SafeMode = 0; - +*/ FILE * cpuTempSensor = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); if (cpuTempSensor) { // double cpuTemp; @@ -930,13 +931,20 @@ int main(int argc, char * argv[]) { if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) { fprintf(stderr,"Battery voltage low - switch to battery saver\n"); - if (battery_saver_mode == OFF) + if (battery_saver_mode == OFF) { battery_saver(ON); + printf("Safe Mode!\n"); + SafeMode = 1; + + } } else if ((battery_saver_mode == ON) && (batteryCurrent < 0) && !sim_mode && !hab_mode) { fprintf(stderr,"Battery is being charged - switch battery saver off\n"); - if (battery_saver_mode == ON) - battery_saver(OFF); + if (battery_saver_mode == ON) { + battery_saver(OFF); + printf("Safe Mode off!\n"); + SafeMode = 0; + } } if ((batteryCurrent > currentThreshold) && (batteryVoltage < voltageThreshold) && !sim_mode && !hab_mode) // currentThreshold ensures that this won't happen when running on DC power. { From 56d977746931ec3d7af26eb0d2744169d7818692 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:19:28 -0500 Subject: [PATCH 02/18] Update rpitx.py add Safe Mode print --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 3b6d7617..dbb7d758 100644 --- a/rpitx.py +++ b/rpitx.py @@ -62,9 +62,10 @@ def battery_saver_check(): f = open("/home/pi/CubeSatSim/battery_saver", "r") f.close() txc = False + print("Safe Mode!") print("battery saver activated") except: - print("not activated") + print("battery saver not activated") # txc = True def increment_mode(): From 2fdca3524a3e4617a80489457e3c9bb95bbb681c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:25:09 -0500 Subject: [PATCH 03/18] Update config change from battery saver to safe mode --- config | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/config b/config index 9d3a6feb..42076c06 100755 --- a/config +++ b/config @@ -70,6 +70,7 @@ if [ "$1" = "" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then + echo "Safe Mode!" echo "Battery saver mode is ON" else echo "Battery saver mode is OFF" @@ -100,6 +101,7 @@ elif [ "$1" = "-a" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then + echo "Safe Mode!" echo "Battery saver mode is ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else @@ -119,6 +121,7 @@ elif [ "$1" = "-m" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then + echo "Safe Mode!" echo "Battery saver mode is ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else @@ -154,6 +157,7 @@ elif [ "$1" = "-s" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then + echo "Safe Mode!" echo "Battery saver mode ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else @@ -482,30 +486,32 @@ elif [ "$1" = "-R" ]; then elif [ "$1" = "-B" ]; then echo - echo "Manually setting battery saver mode" + echo "Manually setting Safe Mode (battery saver mode)" echo FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then + echo "Safe Mode!" echo "Battery saver mode is ON." mode=1 else + echo "Safe Mode is OFF." echo "Battery saver mode is OFF." mode=0 fi echo - echo "Do you want Battery saver mode ON (y/n) " + echo "Do you want Safe Mode (battery saver mode) ON (y/n) " read saver echo if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then - echo "Battery saver mode is now ON" + echo "Safe Mode! Battery saver mode is now ON" touch /home/pi/CubeSatSim/battery_saver # if ["$mode" = "0"] ; then sudo systemctl restart rpitx else - echo "Battery saver mode is now OFF" + echo "Safe Mode is OFF. Battery saver mode is now OFF" sudo rm /home/pi/CubeSatSim/battery_saver # if ["$mode" = "1"] ; then sudo systemctl restart rpitx fi @@ -704,7 +710,7 @@ elif [ "$1" = "-h" ]; then echo " -C Clear logs" echo " -T Change command and control state" echo " -R Change the Commands Count in the file command_count.txt" - echo " -B Change battery saver mode manually" + echo " -B Change Safe Mode (battery saver mode) manually" echo " -q Change the Squelch setting for command receiver" echo " -F Change the rx and tx frequency" echo " -H Chnage the Balloon mode" From 96fe99bb429c3adcd5c9e1029c270dd06cf1bafe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:35:05 -0500 Subject: [PATCH 04/18] Update config only rm battery saver if changed --- config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config b/config index 42076c06..4662e932 100755 --- a/config +++ b/config @@ -512,8 +512,7 @@ elif [ "$1" = "-B" ]; then # if ["$mode" = "0"] ; then sudo systemctl restart rpitx else echo "Safe Mode is OFF. Battery saver mode is now OFF" - sudo rm /home/pi/CubeSatSim/battery_saver -# if ["$mode" = "1"] ; then sudo systemctl restart rpitx + if ["$mode" = "1"] ; then sudo rm /home/pi/CubeSatSim/battery_saver fi value=`cat /home/pi/CubeSatSim/.mode` From bdef1208d44c485752b55dad5cbe92818cedf642 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:36:50 -0500 Subject: [PATCH 05/18] Update config -B fix --- config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config b/config index 4662e932..74e8d91c 100755 --- a/config +++ b/config @@ -512,7 +512,9 @@ elif [ "$1" = "-B" ]; then # if ["$mode" = "0"] ; then sudo systemctl restart rpitx else echo "Safe Mode is OFF. Battery saver mode is now OFF" - if ["$mode" = "1"] ; then sudo rm /home/pi/CubeSatSim/battery_saver + if ["$mode" = "1"] ; then + sudo rm /home/pi/CubeSatSim/battery_saver + fi fi value=`cat /home/pi/CubeSatSim/.mode` From 740a82b71c0b745b3b67e7f47df4042841f03e3f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:38:00 -0500 Subject: [PATCH 06/18] Update config typo --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index 74e8d91c..fd50b092 100755 --- a/config +++ b/config @@ -509,10 +509,10 @@ elif [ "$1" = "-B" ]; then if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then echo "Safe Mode! Battery saver mode is now ON" touch /home/pi/CubeSatSim/battery_saver -# if ["$mode" = "0"] ; then sudo systemctl restart rpitx +# if [ "$mode" = "0" ] ; then sudo systemctl restart rpitx else echo "Safe Mode is OFF. Battery saver mode is now OFF" - if ["$mode" = "1"] ; then + if [ "$mode" = "1" ] ; then sudo rm /home/pi/CubeSatSim/battery_saver fi fi From 8d03cbec58e8cba2fd4ba4d2c58ea1c527348e53 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:54:42 -0500 Subject: [PATCH 07/18] Update main.c more safe mode things --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 0ae6eade..af9111c6 100644 --- a/main.c +++ b/main.c @@ -933,7 +933,7 @@ int main(int argc, char * argv[]) { fprintf(stderr,"Battery voltage low - switch to battery saver\n"); if (battery_saver_mode == OFF) { battery_saver(ON); - printf("Safe Mode!\n"); + fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);"Safe Mode!\n"); SafeMode = 1; } @@ -942,7 +942,7 @@ int main(int argc, char * argv[]) { fprintf(stderr,"Battery is being charged - switch battery saver off\n"); if (battery_saver_mode == ON) { battery_saver(OFF); - printf("Safe Mode off!\n"); + fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);"Safe Mode off!\n"); SafeMode = 0; } } @@ -2428,6 +2428,7 @@ int battery_saver_check() { return(OFF); } fclose(file); + fprintf(stderr, "Safe Mode!"); fprintf(stderr,"Battery saver mode is ON!\n"); return(ON); } @@ -2438,6 +2439,7 @@ if (setting == ON) { if (battery_saver_check() == OFF) { FILE *command = popen("touch /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); + fprintf(stderr,"Turning Safe Mode ON\n"); fprintf(stderr,"Turning Battery saver mode ON\n"); // command = popen("if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo force_turbo=1 >> /boot/config.txt'; fi", "r"); // pclose(command); From 82cb05e3d99bd31d9034416c1f861248e5fec0f0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 09:55:54 -0500 Subject: [PATCH 08/18] Update main.c fix safe mode tyops --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index af9111c6..167ab2db 100644 --- a/main.c +++ b/main.c @@ -933,7 +933,7 @@ int main(int argc, char * argv[]) { fprintf(stderr,"Battery voltage low - switch to battery saver\n"); if (battery_saver_mode == OFF) { battery_saver(ON); - fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);"Safe Mode!\n"); + fprintf(stderr, "Safe Mode!\n"); SafeMode = 1; } @@ -942,7 +942,7 @@ int main(int argc, char * argv[]) { fprintf(stderr,"Battery is being charged - switch battery saver off\n"); if (battery_saver_mode == ON) { battery_saver(OFF); - fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);"Safe Mode off!\n"); + fprintf(stderr, "Safe Mode off!\n"); SafeMode = 0; } } From ea4edac08654daffef3e7cc5ab4100b30861a441 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:07:52 -0500 Subject: [PATCH 09/18] Update main.c cleanup --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 167ab2db..b99eb362 100644 --- a/main.c +++ b/main.c @@ -1278,7 +1278,7 @@ void get_tlm(void) { strcat(str, cw_footer3); // printf("Str: %s \n", str); // fflush(stdout); - printf("CW string to execute: %s\n", str); + printf("CW string to execute:: %s\n", str); fflush(stdout); FILE * cw_file = popen(str, "r"); @@ -2428,7 +2428,7 @@ int battery_saver_check() { return(OFF); } fclose(file); - fprintf(stderr, "Safe Mode!"); + fprintf(stderr, "Safe Mode!\n"); fprintf(stderr,"Battery saver mode is ON!\n"); return(ON); } From acdc3897ff9e0305553561eed3bd4157bc8dd5f7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:22:03 -0500 Subject: [PATCH 10/18] Update main.c don't print in battery saver check --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index b99eb362..5422f54c 100644 --- a/main.c +++ b/main.c @@ -190,12 +190,12 @@ int main(int argc, char * argv[]) { battery_saver_mode = battery_saver_check(); -/* +/**/ if (battery_saver_mode == ON) - fprintf(stderr, "\nBattery_saver_mode is ON\n\n"); + fprintf(stderr, "Safe Mode! Battery_saver_mode is ON\n\n"); else fprintf(stderr, "\nBattery_saver_mode is OFF\n\n"); -*/ +/**/ fflush(stderr); if (mode == AFSK) @@ -1336,7 +1336,7 @@ void get_tlm(void) { */ strcat(str, footer_str1); // strcat(str, call); - if (battery_saver_mode == ON) + if ( == ON) strcat(str, footer_str); // add extra packet for rpitx transmission else strcat(str, footer_str2); @@ -2424,12 +2424,12 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 int battery_saver_check() { FILE *file = fopen("/home/pi/CubeSatSim/battery_saver", "r"); if (file == NULL) { - fprintf(stderr,"Battery saver mode is OFF!\n"); +// fprintf(stderr,"Battery saver mode is OFF!\n"); return(OFF); } fclose(file); - fprintf(stderr, "Safe Mode!\n"); - fprintf(stderr,"Battery saver mode is ON!\n"); +// fprintf(stderr, "Safe Mode!\n"); +// fprintf(stderr,"Battery saver mode is ON!\n"); return(ON); } From 1991a9144e6ff28197d28301be9f2f4464c85f51 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:23:59 -0500 Subject: [PATCH 11/18] Update config print safe mode and saver on same line --- config | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/config b/config index fd50b092..eb8ed230 100755 --- a/config +++ b/config @@ -70,8 +70,7 @@ if [ "$1" = "" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Safe Mode!" - echo "Battery saver mode is ON" + echo "Safe Mode! Battery saver mode is ON" else echo "Battery saver mode is OFF" fi @@ -101,8 +100,7 @@ elif [ "$1" = "-a" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Safe Mode!" - echo "Battery saver mode is ON." + echo "Safe Mode! Battery saver mode is ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Battery saver mode is OFF." @@ -121,8 +119,7 @@ elif [ "$1" = "-m" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Safe Mode!" - echo "Battery saver mode is ON." + echo "Safe Mode! Battery saver mode is ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Battery saver mode is OFF." @@ -157,8 +154,7 @@ elif [ "$1" = "-s" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Safe Mode!" - echo "Battery saver mode ON." + echo "Safe Mode! Battery saver mode ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Battery saver mode is OFF." @@ -491,8 +487,7 @@ elif [ "$1" = "-B" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Safe Mode!" - echo "Battery saver mode is ON." + echo "Safe Mode! Battery saver mode is ON." mode=1 else echo "Safe Mode is OFF." From 6c1a55b8517998ea2171ed11fac8da20e5b5fd8a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:27:25 -0500 Subject: [PATCH 12/18] Update main.c added missing variable --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 5422f54c..53cd1aab 100644 --- a/main.c +++ b/main.c @@ -1336,7 +1336,7 @@ void get_tlm(void) { */ strcat(str, footer_str1); // strcat(str, call); - if ( == ON) + if (battery_saver_mode == ON) strcat(str, footer_str); // add extra packet for rpitx transmission else strcat(str, footer_str2); From 018d50ff10363e0c36749671a5d99a0e1e699723 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:31:41 -0500 Subject: [PATCH 13/18] Update main.c fix cwready --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 53cd1aab..b4f85351 100644 --- a/main.c +++ b/main.c @@ -1275,17 +1275,17 @@ void get_tlm(void) { // printf("Str str: %s \n", str); // fflush(stdout); - strcat(str, cw_footer3); +// strcat(str, cw_footer3); // printf("Str: %s \n", str); // fflush(stdout); - printf("CW string to execute:: %s\n", str); - fflush(stdout); +// printf("CW string to execute:: %s\n", str); +// fflush(stdout); - FILE * cw_file = popen(str, "r"); - pclose(cw_file); +// FILE * cw_file = popen(str, "r"); +// pclose(cw_file); -// FILE * cw_file = popen(cwready, "r"); -// pclose(cw_file); + FILE * cw_file = popen(cwready, "r"); + pclose(cw_file); while ((cw_file = fopen("/home/pi/CubeSatSim/cwready", "r")) != NULL) { // wait for rpitx to be done fclose(cw_file); From 04b5b9ca786c17b4b386e5a49e61de58dd31e9ae Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:34:48 -0500 Subject: [PATCH 14/18] Update main.c don't say switch unless switching --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index b4f85351..81b4607e 100644 --- a/main.c +++ b/main.c @@ -930,8 +930,9 @@ int main(int argc, char * argv[]) { if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) { - fprintf(stderr,"Battery voltage low - switch to battery saver\n"); + fprintf(stderr,"Battery voltage low\n"); if (battery_saver_mode == OFF) { + fprintf(stderr,"Switch to battery saver\n"); battery_saver(ON); fprintf(stderr, "Safe Mode!\n"); SafeMode = 1; From f311f1f076857763f2d7b0d74215c13a879da77a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 10:52:05 -0500 Subject: [PATCH 15/18] Update rpitx.py move cw pd and put --- rpitx.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rpitx.py b/rpitx.py index dbb7d758..15782c3d 100644 --- a/rpitx.py +++ b/rpitx.py @@ -490,22 +490,23 @@ if __name__ == "__main__": system(command) ## chan = chan + 1 if (command_tx == True): - output(txLed, txLedOn) - output (pd, 1) - sleep(0.3) - output (ptt, 0) + output(txLed, txLedOn) if (txc): + output (pd, 1) + sleep(0.3) + output (ptt, 0) system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") + sleep(0.1) + output (ptt, 1) +# output (pd, 0) else: if (debug_mode == 1): system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") else: - system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") - - sleep(0.1) + system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff) - output (ptt, 1) + command_control_check() f.close() sleep(5) From 3c090c52854bed841ec4f21222a439270c243c7b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 11:16:23 -0500 Subject: [PATCH 16/18] Update config only reboot in -B if changes --- config | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/config b/config index eb8ed230..62fb1e12 100755 --- a/config +++ b/config @@ -500,26 +500,33 @@ elif [ "$1" = "-B" ]; then echo "Do you want Safe Mode (battery saver mode) ON (y/n) " read saver echo - + + reboot = 0 + if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then echo "Safe Mode! Battery saver mode is now ON" touch /home/pi/CubeSatSim/battery_saver -# if [ "$mode" = "0" ] ; then sudo systemctl restart rpitx + if [ "$mode" = "0" ] ; then + reboot = 1 + fi else echo "Safe Mode is OFF. Battery saver mode is now OFF" if [ "$mode" = "1" ] ; then sudo rm /home/pi/CubeSatSim/battery_saver + reboot = 1 fi fi - value=`cat /home/pi/CubeSatSim/.mode` - echo "$value" > /dev/null - set -- $value - - if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then - echo "rebooting" -# sudo systemctl restart cubesatsim - sudo reboot now + if [ "$reboot" = "1" ] ; then + value=`cat /home/pi/CubeSatSim/.mode` + echo "$value" > /dev/null + set -- $value + + if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then + echo "rebooting" + # sudo systemctl restart cubesatsim + sudo reboot now + fi fi elif [ "$1" = "-q" ]; then From 8e9c32cf7da4c5f35099362b03a1d991c7b7d632 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 11:17:52 -0500 Subject: [PATCH 17/18] Update config remove spaces --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 62fb1e12..48725b77 100755 --- a/config +++ b/config @@ -501,19 +501,19 @@ elif [ "$1" = "-B" ]; then read saver echo - reboot = 0 + reboot=0 if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then echo "Safe Mode! Battery saver mode is now ON" touch /home/pi/CubeSatSim/battery_saver if [ "$mode" = "0" ] ; then - reboot = 1 + reboot=1 fi else echo "Safe Mode is OFF. Battery saver mode is now OFF" if [ "$mode" = "1" ] ; then sudo rm /home/pi/CubeSatSim/battery_saver - reboot = 1 + reboot=1 fi fi From 3275441e5a6ecec220935170ab16e1b4709adc58 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 4 Mar 2024 11:21:01 -0500 Subject: [PATCH 18/18] Update config say will be turned on/off --- config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config b/config index 48725b77..33da8587 100755 --- a/config +++ b/config @@ -504,14 +504,15 @@ elif [ "$1" = "-B" ]; then reboot=0 if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then - echo "Safe Mode! Battery saver mode is now ON" - touch /home/pi/CubeSatSim/battery_saver if [ "$mode" = "0" ] ; then + echo "Safe Mode will be turned on! Battery saver will be turned ON" + sudo touch /home/pi/CubeSatSim/battery_saver reboot=1 fi else - echo "Safe Mode is OFF. Battery saver mode is now OFF" + if [ "$mode" = "1" ] ; then + echo "Safe Mode will be turned OFF. Battery saver mode will be turned OFF" sudo rm /home/pi/CubeSatSim/battery_saver reboot=1 fi