From a2a4a7d3b5f65a9e53838874787479339bb4cb49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 19:48:55 -0500 Subject: [PATCH 01/18] Update config added -H to set HAB mode --- config | 91 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 20 deletions(-) diff --git a/config b/config index 3b562b38..1422bd49 100755 --- a/config +++ b/config @@ -40,6 +40,13 @@ if [ "$1" = "" ]; then echo "Simulated Telemetry is OFF" fi + + if [ "$9" = "yes" ] || [ "$9" = "y" ]; then + echo "HAB mode is ON" + else + echo "HAB mode is OFF" + fi + echo echo "Current command count is:" cat /home/pi/CubeSatSim/command_count.txt @@ -55,7 +62,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 $6 $7 $8 + echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo echo "To change, include an OPTION" @@ -157,6 +164,7 @@ elif [ "$1" = "-h" ]; then echo " -B Change 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 HAB mode" echo exit @@ -179,7 +187,7 @@ elif [ "$1" = "-t" ]; then echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo "Do you want Simulated Telemetry ON (y/n) " read sim @@ -196,8 +204,8 @@ elif [ "$1" = "-t" ]; then echo echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $1 $2 $3 $4 $sim $6 $7 $8 - echo $1 $2 $3 $4 $sim $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 + echo $1 $2 $3 $4 $sim $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg echo echo "Restarting CubeSatSim with new configuraation file" echo @@ -222,7 +230,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo "Enter callsign in all capitals: " read callsign @@ -236,8 +244,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 $6 $7 $8 - echo $callsign $2 $3 $4 $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 + echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -268,7 +276,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo -e "Enter Reset Count (integer): " @@ -288,8 +296,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 $6 $7 $8 - echo $1 $resets $3 $4 $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 + echo $1 $resets $3 $4 $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -321,7 +329,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo -e "Enter latitude (decimal degrees, positive is north): " @@ -363,8 +371,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 $6 $7 $8 - echo $1 $2 $lat $long $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 $7 $8 $9 + echo $1 $2 $lat $long $5 $6 $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -510,7 +518,7 @@ elif [ "$1" = "-q" ]; then echo $6 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo -e "Enter squelch (integer 0 - 8): " @@ -532,8 +540,8 @@ elif [ "$1" = "-q" ]; then echo echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $1 $2 $3 $4 $5 $sq $7 $8 - echo $1 $2 $3 $4 $4 $sq $7 $8 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $sq $7 $8 $9 + echo $1 $2 $3 $4 $4 $sq $7 $8 $9 > /home/pi/CubeSatSim/sim.cfg echo echo "Restarting CubeSatSim with new configuraation file" echo @@ -561,7 +569,7 @@ elif [ "$1" = "-F" ]; then echo $8 echo -# echo $1 $2 $3 $4 $5 $6 $7 $8 +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 echo "Enter tx frequency as 4XX.XXXX: " read tx @@ -584,8 +592,8 @@ elif [ "$1" = "-F" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $2 $3 $4 $5 $6 $tx $rx - echo $1 $2 $3 $4 $5 $6 $tx $rx > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 + echo $1 $2 $3 $4 $5 $6 $tx $rx $9 > /home/pi/CubeSatSim/sim.cfg # fi # if [ "$norestart" = "1" ]; then @@ -596,7 +604,50 @@ elif [ "$1" = "-F" ]; then echo sudo systemctl restart cubesatsim # fi - +elif [ "$1" = "-H" ]; then + + echo + echo "Editing the High Altitude Balloon (HAB) setting in" + echo "the configuration file for CubeSatSim" + echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + if [ "$9" = "yes" ] || [ "$9" = "y" ]; then + echo "HAB mode is ON" + else + echo "HAB mode is OFF" + fi + + echo + +# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 + + echo "Do you want HAB mode ON (y/n) " + read hab + echo + + if [ "$hab" = "y" ] || [ "$hab" = "yes" ] ; then + hab="yes" + echo "HAB mode is ON" + else + hab="no" + echo "HAB mode is OFF" + fi + + echo + echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + echo + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab + echo $1 $2 $3 $4 $5 $6 $7 $8 $hab > /home/pi/CubeSatSim/sim.cfg + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + + sudo systemctl restart cubesatsim + fi # sudo systemctl restart cubesatsim From 388aeee8cd41364de39bceda704104f9fd4bee97 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 20:03:03 -0500 Subject: [PATCH 02/18] Update main.c added hab_yes and hab_mode --- main.c | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index b0e12675..1c2edd48 100644 --- a/main.c +++ b/main.c @@ -59,10 +59,11 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s %d %s %s", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx); + fscanf(config_file, "%s %d %f %f %s %d %s %s %s", + call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes); fclose(config_file); - printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s\n", - call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx); + printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s\n", + call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes); printf("Transmit on %s Receive on %s\n", tx, rx); @@ -90,6 +91,10 @@ int main(int argc, char * argv[]) { if (strcmp(sim_yes, "yes") == 0) sim_mode = TRUE; + if (strcmp(hab_yes, "yes") == 0) + hab_mode = TRUE; + + // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); @@ -108,9 +113,10 @@ int main(int argc, char * argv[]) { // sleep(2); -#ifdef HAB - printf("HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown\n"); -#endif +//#ifdef HAB + if (hab_mode) + printf("HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown\n"); +//#endif // FILE * rpitx_restart = popen("sudo systemctl restart rpitx", "r"); // pclose(rpitx_restart); @@ -830,18 +836,19 @@ int main(int argc, char * argv[]) { // fprintf(stderr, "\n\nbattery_saver_mode : %d current: %f\n", battery_saver_mode, batteryCurrent); #ifndef HAB - if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode) + + 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) battery_saver(ON); - } else if ((battery_saver_mode == ON) && (batteryCurrent < 0)) + } 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 ((batteryCurrent > currentThreshold) && (batteryVoltage < voltageThreshold) && !sim_mode) // currentThreshold ensures that this won't happen when running on DC power. + if ((batteryCurrent > currentThreshold) && (batteryVoltage < voltageThreshold) && !sim_mode && !hab_mode) // currentThreshold ensures that this won't happen when running on DC power. { fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); digitalWrite(txLed, txLedOff); @@ -1047,11 +1054,13 @@ void get_tlm(void) { if (ax5043) sprintf(header_str2b, "=%s%c%sShi hi ", header_lat, 0x5c, header_long); // add APRS lat and long else -#ifdef HAB - sprintf(header_str2b, "=%s%c%sOhi hi ", header_lat, 0x2f, header_long); // add APRS lat and long with Balloon HAB icon -#else - sprintf(header_str2b, "=%s%c%c%sShi hi ", header_lat, 0x5c, 0x5c, header_long); // add APRS lat and long with Satellite icon -#endif +//#ifdef HAB + if (hab_mode) + sprintf(header_str2b, "=%s%c%sOhi hi ", header_lat, 0x2f, header_long); // add APRS lat and long with Balloon HAB icon +//#else + else + sprintf(header_str2b, "=%s%c%c%sShi hi ", header_lat, 0x5c, 0x5c, header_long); // add APRS lat and long with Satellite icon +//#endif printf("\n\nString is %s \n\n", header_str2b); strcat(str, header_str2b); @@ -1070,18 +1079,21 @@ void get_tlm(void) { channel, upper_digit(tlm[channel][4]), lower_digit(tlm[channel][4])); // printf("%s",tlm_str); -#ifdef HAB - if (mode != AFSK) -#endif +//#ifdef HAB +// if (mode != AFSK) +//#endif + if ((!hab_mode) || ((hab_mode) && (mode != AFSK))) strcat(str, tlm_str); } -#ifdef HAB - if (mode == AFSK) { +//#ifdef HAB + if ((mode == AFSK) && (hab_mode)) { sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent); strcat(str, tlm_str); - } -#endif + } else + strcat(str, tlm_str); // Is this needed??? + +//#endif // read payload sensor if available /* char sensor_payload[500]; From 41070be35038e523f36c1c41e82cb4739bfd9041 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 20:03:34 -0500 Subject: [PATCH 03/18] Update main.h added hab_yes --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index fdbc7323..19079191 100644 --- a/main.h +++ b/main.h @@ -124,6 +124,7 @@ float uptime_sec = 0; long int uptime; char call[5]; char sim_yes[10]; +char hab_yes[10]; int squelch = 3; // default squelch char rx[12], tx[12]; From bdb17d76257068cf7d14aa274a2dd06a8d3cdae4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 22:35:05 -0500 Subject: [PATCH 04/18] Update main.c print sim mode --- main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 1c2edd48..e9a167b9 100644 --- a/main.c +++ b/main.c @@ -88,12 +88,14 @@ int main(int argc, char * argv[]) { newGpsTime = millis(); } - if (strcmp(sim_yes, "yes") == 0) + if (strcmp(sim_yes, "yes") == 0) { sim_mode = TRUE; - - if (strcmp(hab_yes, "yes") == 0) + fprintf(stderr, "Sim mode is ON\n"); + } + if (strcmp(hab_yes, "yes") == 0) { hab_mode = TRUE; - + fprintf(stderr, "HAB mode is ON\n"); + } // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); From b69a78c8e21995b3607640ec242731d5807c02fa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 22:40:05 -0500 Subject: [PATCH 05/18] Update main.c removed HAB macro --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index e9a167b9..1b4eef09 100644 --- a/main.c +++ b/main.c @@ -837,7 +837,7 @@ int main(int argc, char * argv[]) { // if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V // fprintf(stderr, "\n\nbattery_saver_mode : %d current: %f\n", battery_saver_mode, batteryCurrent); -#ifndef HAB +//#ifndef HAB if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) { @@ -872,7 +872,8 @@ int main(int argc, char * argv[]) { pclose(file6); sleep(10); } -#endif +//#endif + FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); if (fp != NULL) { printf("Writing telem_string.txt\n"); From 31ee958dc5869daaa20855f6cafb1890342a4ab7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 22:49:34 -0500 Subject: [PATCH 06/18] Update main.c added more printfs --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 1b4eef09..8b8476e4 100644 --- a/main.c +++ b/main.c @@ -62,24 +62,24 @@ int main(int argc, char * argv[]) { fscanf(config_file, "%s %d %f %f %s %d %s %s %s", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes); fclose(config_file); - printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s\n", + fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s\n", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes); - printf("Transmit on %s Receive on %s\n", tx, rx); + fprintf(stderr, "Transmit on %s Receive on %s\n", tx, rx); // program_radio(); // do in rpitx instead reset_count = (reset_count + 1) % 0xffff; if ((fabs(lat_file) > 0) && (fabs(lat_file) < 90.0) && (fabs(long_file) > 0) && (fabs(long_file) < 180.0)) { - printf("Valid latitude and longitude in config file\n"); + fprintf(stderr, "Valid latitude and longitude in config file\n"); // convert to APRS DDMM.MM format // latitude = toAprsFormat(lat_file); // longitude = toAprsFormat(long_file); latitude = lat_file; longitude = long_file; - printf("Lat/Long %f %f\n", latitude, longitude); - printf("Lat/Long in APRS DDMM.MM format: %07.2f/%08.2f\n", toAprsFormat(latitude), toAprsFormat(longitude)); + fprintf(stderr, "Lat/Long %f %f\n", latitude, longitude); + fprintf(stderr, "Lat/Long in APRS DDMM.MM format: %07.2f/%08.2f\n", toAprsFormat(latitude), toAprsFormat(longitude)); newGpsTime = millis(); } else { // set default @@ -117,7 +117,7 @@ int main(int argc, char * argv[]) { //#ifdef HAB if (hab_mode) - printf("HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown\n"); + fprintf(stderr, "HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown\n"); //#endif // FILE * rpitx_restart = popen("sudo systemctl restart rpitx", "r"); From 91a1e3b63115c75de9b0f354aec1b1aa93ae2749 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 20 Nov 2023 22:53:56 -0500 Subject: [PATCH 07/18] Update main.c fixed writing of sim.cfg --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8b8476e4..ab6a7204 100644 --- a/main.c +++ b/main.c @@ -319,7 +319,7 @@ 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", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From 200939cee615689cd232e18bdef25e881ff64be1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 09:47:27 -0500 Subject: [PATCH 08/18] Update config cleanup --- config | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/config b/config index 1422bd49..c124f620 100755 --- a/config +++ b/config @@ -39,7 +39,7 @@ if [ "$1" = "" ]; then # sim="no" echo "Simulated Telemetry is OFF" fi - + echo if [ "$9" = "yes" ] || [ "$9" = "y" ]; then echo "HAB mode is ON" @@ -48,16 +48,25 @@ if [ "$1" = "" ]; then fi echo - echo "Current command count is:" + echo -e "Current command count is: " cat /home/pi/CubeSatSim/command_count.txt echo echo - echo "Current beacon transmit mode is:" - cat /home/pi/CubeSatSim/command_tx - echo +# echo "Current beacon transmit mode is:" +# cat /home/pi/CubeSatSim/command_tx +# echo echo "Squelch level is:" echo $6 + echo + + FILE=/home/pi/CubeSatSim/battery_saver + if [ -f "$FILE" ]; then + echo "Battery saver mode is ON" + else + echo "Battery saver is OFF" + fi + echo echo -e "Current sim.cfg configuration file:" echo From 39f9e322abe4076bc4b6e83974ddeacc5d98612c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 10:00:31 -0500 Subject: [PATCH 09/18] Update config more cleanup --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index c124f620..180689b4 100755 --- a/config +++ b/config @@ -48,7 +48,7 @@ if [ "$1" = "" ]; then fi echo - echo -e "Current command count is: " + echo -n "Current command count is: " cat /home/pi/CubeSatSim/command_count.txt echo echo @@ -56,7 +56,7 @@ if [ "$1" = "" ]; then # cat /home/pi/CubeSatSim/command_tx # echo - echo "Squelch level is:" + echo -n "Squelch level is: " echo $6 echo From 8581a490b0d9ff19f88b0decfe915766ecb89683 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 14:29:54 -0500 Subject: [PATCH 10/18] Update main.c don't change config.txt --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index ab6a7204..6ac03a3c 100644 --- a/main.c +++ b/main.c @@ -2316,8 +2316,8 @@ if (setting == ON) { FILE *command = popen("touch /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); 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); +// 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); command = popen("sudo reboot now", "r"); pclose(command); sleep(60); @@ -2331,8 +2331,8 @@ if (setting == ON) { FILE *command = popen("rm /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); fprintf(stderr,"Turning Battery saver mode OFF\n"); - command = popen("sudo sed -i ':a;N;$!ba;s/\'$'\n''force_turbo=1//g' /boot/config.txt", "r"); - pclose(command); +// command = popen("sudo sed -i ':a;N;$!ba;s/\'$'\n''force_turbo=1//g' /boot/config.txt", "r"); +// pclose(command); command = popen("sudo reboot now", "r"); pclose(command); sleep(60); From 9a5390f30993ea4d7afe5ec413a3ff9743add8cd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 14:32:47 -0500 Subject: [PATCH 11/18] Update config no config,txt change --- config | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config b/config index 180689b4..0bc7cde9 100755 --- a/config +++ b/config @@ -92,10 +92,10 @@ elif [ "$1" = "-a" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Battery saver mode activated." - if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi +# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Not battery saver mode" - sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt +# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" @@ -109,10 +109,10 @@ elif [ "$1" = "-m" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Battery saver mode activated." - if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi + # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Not battery saver mode" - sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt + # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" sudo reboot now @@ -121,7 +121,7 @@ elif [ "$1" = "-m" ]; then elif [ "$1" = "-f" ]; then echo "changing CubeSatSim to FSK mode" sudo echo "f" > /home/pi/CubeSatSim/.mode - if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi +# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi echo "rebooting" sudo reboot now # sudo systemctl restart cubesatsim @@ -129,7 +129,7 @@ elif [ "$1" = "-f" ]; then elif [ "$1" = "-b" ]; then echo "changing CubeSatSim to BPSK mode" sudo echo "b" > /home/pi/CubeSatSim/.mode - if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi +# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi echo "rebooting" sudo reboot now # sudo systemctl restart cubesatsim @@ -141,10 +141,10 @@ elif [ "$1" = "-s" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Battery saver mode activated." - if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi +# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Not battery saver mode" - sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt +# sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" sudo reboot now From f4750bb9eb4971833dc35c62dd70d9107c8e1344 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 15:07:08 -0500 Subject: [PATCH 12/18] Update config stop rpitx when rebooting --- config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config b/config index 0bc7cde9..f0c677a6 100755 --- a/config +++ b/config @@ -115,6 +115,7 @@ elif [ "$1" = "-m" ]; then # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" + sudo systemctl stop rpitx sudo reboot now # sudo systemctl restart cubesatsim exit @@ -123,6 +124,7 @@ elif [ "$1" = "-f" ]; then sudo echo "f" > /home/pi/CubeSatSim/.mode # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi echo "rebooting" + sudo systemctl stop rpitx sudo reboot now # sudo systemctl restart cubesatsim exit @@ -131,6 +133,7 @@ elif [ "$1" = "-b" ]; then sudo echo "b" > /home/pi/CubeSatSim/.mode # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi echo "rebooting" + sudo systemctl stop rpitx sudo reboot now # sudo systemctl restart cubesatsim exit @@ -147,6 +150,7 @@ elif [ "$1" = "-s" ]; then # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" + sudo systemctl stop rpitx sudo reboot now # sudo systemctl restart cubesatsim exit @@ -441,11 +445,13 @@ elif [ "$1" = "-T" ]; then sudo sed -i 's/False/True/g' /home/pi/CubeSatSim/command_tx echo "Command state set to True to enable beacon" echo "rebooting" + sudo systemctl stop rpitx sudo reboot now else sudo sed -i 's/True/False/g' /home/pi/CubeSatSim/command_tx echo "Command state set to False to disable beacon" echo "rebooting" + sudo systemctl stop rpitx sudo reboot now fi From 56e655b9f7f3af7ec86baed2cd3efe45341ee7cb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 15:32:38 -0500 Subject: [PATCH 13/18] Update main.c APRS always BAT telem --- main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 6ac03a3c..c4fb6418 100644 --- a/main.c +++ b/main.c @@ -117,7 +117,7 @@ int main(int argc, char * argv[]) { //#ifdef HAB if (hab_mode) - fprintf(stderr, "HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown\n"); + fprintf(stderr, "HAB mode enabled - in APRS balloon icon and no battery saver or low voltage shutdown\n"); //#endif // FILE * rpitx_restart = popen("sudo systemctl restart rpitx", "r"); @@ -1072,7 +1072,7 @@ void get_tlm(void) { } // } printf("Str: %s \n", str); - + if (mode == CW) { int channel; for (channel = 1; channel < 7; channel++) { sprintf(tlm_str, "%d%d%d %d%d%d %d%d%d %d%d%d ", @@ -1085,17 +1085,18 @@ void get_tlm(void) { //#ifdef HAB // if (mode != AFSK) //#endif - if ((!hab_mode) || ((hab_mode) && (mode != AFSK))) + // if ((!hab_mode) || ((hab_mode) && (mode != AFSK))) strcat(str, tlm_str); } + } else { // APRS //#ifdef HAB - if ((mode == AFSK) && (hab_mode)) { +// if ((mode == AFSK) && (hab_mode)) { sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent); strcat(str, tlm_str); - } else - strcat(str, tlm_str); // Is this needed??? - +// } else +// strcat(str, tlm_str); // Is this needed??? + } //#endif // read payload sensor if available /* From e5520abcdd053d9139ef154807a25ad2123406d4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 15:50:03 -0500 Subject: [PATCH 14/18] Update main.c simulated telem to APRS --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c4fb6418..8daa18ea 100644 --- a/main.c +++ b/main.c @@ -428,7 +428,7 @@ int main(int argc, char * argv[]) { sim_mode = TRUE; - printf("Simulated telemetry mode!\n"); + fprintf(stderr. "Simulated telemetry mode!\n"); srand((unsigned int)time(0)); @@ -702,7 +702,7 @@ int main(int argc, char * argv[]) { batteryVoltage = voltage[map[BAT]]; batteryCurrent = current[map[BAT]]; - if (batteryVoltage < 3.6) { + if (batteryVoltage < 3.7) { SafeMode = 1; printf("Safe Mode!\n"); } else @@ -1092,7 +1092,8 @@ void get_tlm(void) { } else { // APRS //#ifdef HAB // if ((mode == AFSK) && (hab_mode)) { - sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent); +// sprintf(tlm_str, "BAT %4.2f %5.1f ", batteryVoltage, batteryCurrent); + sprintf(tlm_str, "BAT %4.2f %5.1f ", voltage[map[BAT]] , current[map[BAT]] ); strcat(str, tlm_str); // } else // strcat(str, tlm_str); // Is this needed??? From 0ea5b659804689aa132c7bfbf371af16ec49cb70 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 15:51:57 -0500 Subject: [PATCH 15/18] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8daa18ea..3f5fa799 100644 --- a/main.c +++ b/main.c @@ -428,7 +428,7 @@ int main(int argc, char * argv[]) { sim_mode = TRUE; - fprintf(stderr. "Simulated telemetry mode!\n"); + fprintf(stderr, "Simulated telemetry mode!\n"); srand((unsigned int)time(0)); From 3559a954a03b71bf528cec17ed808fdb8510fc95 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 15:57:58 -0500 Subject: [PATCH 16/18] Update config battery_saver restart --- config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config b/config index f0c677a6..06ce0862 100755 --- a/config +++ b/config @@ -98,10 +98,11 @@ elif [ "$1" = "-a" ]; then # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi - echo "rebooting" - sudo reboot now -# sudo systemctl restart cubesatsim +# echo "rebooting" +# sudo reboot now + sudo systemctl restart cubesatsim exit + elif [ "$1" = "-m" ]; then echo "changing CubeSatSim to CW mode" sudo echo "m" > /home/pi/CubeSatSim/.mode From df072962c35c61c23326541fb7a414357dd4a58e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 16:04:53 -0500 Subject: [PATCH 17/18] Update config removed "is activated" --- config | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config b/config index 06ce0862..4ca87ee1 100755 --- a/config +++ b/config @@ -91,10 +91,10 @@ elif [ "$1" = "-a" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Battery saver mode activated." + 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 - echo "Not battery saver mode" + echo "Battery saver mode os OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi @@ -109,10 +109,10 @@ elif [ "$1" = "-m" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Battery saver mode activated." + 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 - echo "Not battery saver mode" + echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" @@ -144,10 +144,10 @@ elif [ "$1" = "-s" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Battery saver mode activated." + 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 - echo "Not battery saver mode" + echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi echo "rebooting" @@ -486,10 +486,10 @@ elif [ "$1" = "-B" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then - echo "Battery saver mode is activated." + echo "Battery saver mode is ON." mode=1 else - echo "Battery saver mode is not activated." + echo "Battery saver mode is OFF." mode=0 fi From 2ad4952dd77362db3c93182e4e7588114f873e55 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 21 Nov 2023 16:28:58 -0500 Subject: [PATCH 18/18] Update config reboot for battery_saver change --- config | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config b/config index 4ca87ee1..e61682b3 100755 --- a/config +++ b/config @@ -64,7 +64,7 @@ if [ "$1" = "" ]; then if [ -f "$FILE" ]; then echo "Battery saver mode is ON" else - echo "Battery saver is OFF" + echo "Battery saver mode is OFF" fi echo @@ -98,9 +98,10 @@ elif [ "$1" = "-a" ]; then # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi -# echo "rebooting" -# sudo reboot now - sudo systemctl restart cubesatsim + echo "rebooting" + sudo systemctl stop rpitx + sudo reboot now +# sudo systemctl restart cubesatsim exit elif [ "$1" = "-m" ]; then @@ -514,8 +515,9 @@ elif [ "$1" = "-B" ]; then set -- $value if [ "$1" = "a" ] || [ "$1" = "s" ] || [ "$1" = "m" ] ; then - echo "restarting" - sudo systemctl restart cubesatsim + echo "rebooting" +# sudo systemctl restart cubesatsim + sudo reboot now fi elif [ "$1" = "-q" ]; then