From 0dbcc9175e859bc3fafe7c329c24f99952d4f539 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 16 Oct 2023 22:37:41 -0400 Subject: [PATCH 01/49] Update main.c fix typo for HAB mode --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 41dc7d9f..c6795cde 100644 --- a/main.c +++ b/main.c @@ -68,7 +68,7 @@ int main(int argc, char * argv[]) { // sleep(2); #ifdef HAB - Serial.println("HAB mode enabled - balloon icon and BAT only telem and no low voltage shutdown"); + 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"); From 2551c3b0cd710980db61bf634849191f50502955 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 7 Nov 2023 15:23:49 -0500 Subject: [PATCH 02/49] Update ina219.py to avoid BrokenPipeError --- ina219.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ina219.py b/ina219.py index 3fb5713e..6f1b44bd 100644 --- a/ina219.py +++ b/ina219.py @@ -7,6 +7,12 @@ import busio from adafruit_extended_bus import ExtendedI2C as I2C from adafruit_ina219 import INA219 from adafruit_ina219 import ADCResolution, BusVoltageRange +import signal + +# Don't turn these signal into exceptions, just die. +# https://stackoverflow.com/questions/26692284/how-to-prevent-brokenpipeerror-when-doing-a-flush-in-python +signal.signal(signal.SIGINT, signal.SIG_DFL) +signal.signal(signal.SIGPIPE, signal.SIG_DFL) if __name__ == "__main__": # print 'Length: ', len(sys.argv) From 2783e455b4720da415b8a6250885982d89eecca9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 11:48:59 -0500 Subject: [PATCH 03/49] Update rpitx.py added file.close --- rpitx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index ca21fe4f..ee501fe0 100644 --- a/rpitx.py +++ b/rpitx.py @@ -20,6 +20,7 @@ def increment_mode(): # mode = "f" if (debug_mode == 1): print("Can't open .mode file") # , defaulting to FSK") + file.close() print("Mode is: ") print(mode) if (mode == 'a'): @@ -253,7 +254,8 @@ if __name__ == "__main__": except: callsign = "AMSAT" if (debug_mode == 1): - print("Can't read callsign from sim.cfg file, defaulting to AMSAT") + print("Can't read callsign from sim.cfg file, defaulting to AMSAT") + file.close() print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT) From a52308ab48a0238801b223adced2e862e6d5f740 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 11:54:15 -0500 Subject: [PATCH 04/49] Update main.c added squelch to sim.cfg --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c6795cde..ef8b2213 100644 --- a/main.c +++ b/main.c @@ -152,9 +152,9 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s", call, & reset_count, & lat_file, & long_file, sim_yes); + fscanf(config_file, "%s %d %f %f %s %d", call, & reset_count, & lat_file, & long_file, sim_yes, squelch); fclose(config_file); - printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s\n", call, reset_count, lat_file, long_file, sim_yes); + printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d\n", call, reset_count, lat_file, long_file, sim_yes, squelch); 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)) { @@ -298,7 +298,7 @@ int main(int argc, char * argv[]) { } */ config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s", call, reset_count, lat_file, long_file, sim_yes); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d", call, reset_count, lat_file, long_file, sim_yes,, squelch); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From 328ef1555cf4d512a9e1c641d17d83c4923bb953 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 11:55:54 -0500 Subject: [PATCH 05/49] Update main.h added squelch = 3 --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 6a9057dc..5b5bdf7d 100644 --- a/main.h +++ b/main.h @@ -123,6 +123,7 @@ float uptime_sec = 0; long int uptime; char call[5]; char sim_yes[10]; +int squelch = 3; // default squelch int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; From 10aeddf6b735a121da3909aa05469081f0b5799a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 12:05:57 -0500 Subject: [PATCH 06/49] Update config added squelch setting --- config | 67 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/config b/config index 6dbc3742..76ccc3b5 100755 --- a/config +++ b/config @@ -51,7 +51,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 + echo $1 $2 $3 $4 $5 $6 echo echo "To change, include an OPTION" @@ -125,6 +125,7 @@ elif [ "$1" = "-h" ]; then echo " -C Clear logs" echo " -T Change command state" echo " -R Change the Commands Count in the file command_count.txt" + echo " -q Change the Squelch setting for command receiver" echo exit @@ -190,7 +191,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 +# echo $1 $2 $3 $4 $5 $6 echo "Enter callsign in all capitals: " read callsign @@ -204,8 +205,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 - echo $callsign $2 $3 $4 $5 > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 + echo $callsign $2 $3 $4 $5 $6 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -236,7 +237,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 +# echo $1 $2 $3 $4 $5 $6 echo -e "Enter Reset Count (integer): " @@ -256,8 +257,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 - echo $1 $resets $3 $4 $5 > /home/pi/CubeSatSim/sim.cfg + echo $1 $resets $3 $4 $5 $6 + echo $1 $resets $3 $4 $5 $6 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -289,7 +290,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 +# echo $1 $2 $3 $4 $5 $6 echo -e "Enter latitude (decimal degrees, positive is north): " @@ -331,8 +332,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 - echo $1 $2 $lat $long $5 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 + echo $1 $2 $lat $long $5 $6 > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -420,6 +421,52 @@ elif [ "$1" = "-R" ]; then else echo "Commands count not reset" fi +elif [ "$1" = "-q" ]; then + + echo + echo "Editing the Squelch setting in" + echo "the configuration file for CubeSatSim" + echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo + echo "Current value of squelch is" + echo $6 + echo + +# echo $1 $2 $3 $4 $5 $6 + + echo -e "Enter squelch (integer 0 - 8): " + + read sq + + if [ -z $sq ] ; then + + sq="$6" + echo "Keeping value of" $lat + fi + + if ! [[ $sq =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then + + echo "Error: not a number!" + sq="$6" + echo "Keeping value of" $sq + fi + + echo + echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" + echo + echo $1 $2 $3 $4 $5 $sq + echo $1 $2 $3 $4 $4 $sq > /home/pi/CubeSatSim/sim.cfg + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + + sudo systemctl restart cubesatsim + fi # sudo systemctl restart cubesatsim From 6ba9235c9bdaa30f1182abd6b8144dc33b5e6786 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 12:09:40 -0500 Subject: [PATCH 07/49] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index ef8b2213..92c652d6 100644 --- a/main.c +++ b/main.c @@ -298,7 +298,7 @@ int main(int argc, char * argv[]) { } */ config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d", call, reset_count, lat_file, long_file, sim_yes,, squelch); + fprintf(config_file, "%s %d %8.4f %8.4f %s %d", call, reset_count, lat_file, long_file, sim_yes, squelch); // fprintf(config_file, "%s %d", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From d9065d901a1704bcfc5a98bd3e8192a29c6c3114 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 12:16:27 -0500 Subject: [PATCH 08/49] Update config added sq output --- config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config b/config index 76ccc3b5..40efcb25 100755 --- a/config +++ b/config @@ -48,6 +48,10 @@ if [ "$1" = "" ]; then echo "Current beacon transmit mode is:" cat /home/pi/CubeSatSim/command_tx echo + + echo "Squelch level is:" + echo $6 + echo echo -e "Current sim.cfg configuration file:" echo From 840c1fd8706e79f64acc13897bad9ecd441587b7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 12:28:09 -0500 Subject: [PATCH 09/49] Update main.c config radio using squelch --- main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 92c652d6..5e5d5472 100644 --- a/main.c +++ b/main.c @@ -2205,8 +2205,17 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 // mySerial.println("AT+DMOSETGROUP=0,144.3900,144.3900,0,3,0,0\r"); // can change to 144.39 for standard APRS // mySerial.println("AT+DMOSETGROUP=0,145.0000,145.0000,0,3,0,0\r"); // can change to 145 for testing ASPRS //#else - char uhf_string[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n"; - serialPrintf(uart_fd, uhf_string); + char uhf_string[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n"; + char uhf_string1[] = "AT+DMOSETGROUP=0,435.0000,434.9100,0,"; // changed frequency to verify + char uhf_string2[] = ",0,0\r\n"; + char sq_string[2]; + sq_string[0] = '0' + squelch; + sq_string[1] = 0; +// serialPrintf(uart_fd, uhf_string); + serialPrintf(uart_fd, uhf_string1); + serialPrintf(uart_fd, sq_string); + serialPrintf(uart_fd, uhf_string2); + // mySerial.println("AT+DMOSETGROUP=0,435.1000,434.9900,0,3,0,0\r"); // squelch set to 3 //#endif sleep(1); From 4b4dcb9edf60f41743c71c5576e7e8bc9c5d1027 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 12:45:32 -0500 Subject: [PATCH 10/49] Update main.c handling telem_string error --- main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 5e5d5472..01842dce 100644 --- a/main.c +++ b/main.c @@ -841,9 +841,12 @@ int main(int argc, char * argv[]) { } #endif FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); - printf("Writing telem_string.txt\n"); - fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); - fclose(fp); + if (fp != NULL) { + printf("Writing telem_string.txt\n"); + fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); + fclose(fp); + } else + printf("Error writing to telem_string.txt\n"); /**/ // sleep(1); // Delay 1 second From 25582c8f7f852dbc83421874477f786422f4790a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 16:02:20 -0500 Subject: [PATCH 11/49] Update main.c added & --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 01842dce..7fd336d1 100644 --- a/main.c +++ b/main.c @@ -152,7 +152,7 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s %d", call, & reset_count, & lat_file, & long_file, sim_yes, squelch); + fscanf(config_file, "%s %d %f %f %s %d", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch); fclose(config_file); printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d\n", call, reset_count, lat_file, long_file, sim_yes, squelch); reset_count = (reset_count + 1) % 0xffff; From 4b8b31d59a62d1daae84d955c322392702928fa0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 17:09:21 -0500 Subject: [PATCH 12/49] Update rpitx.py get squelch from sim.cfg --- rpitx.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index ee501fe0..0de9c94c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -250,7 +250,15 @@ if __name__ == "__main__": try: file = open("/home/pi/CubeSatSim/sim.cfg") - callsign = file.readline().split(" ")[0] +# callsign = file.readline().split(" ")[0] + config = file.readline().split(" ") + callsign = config[0] + sim = config[4] + squelch = config[5] + print(callsign) + print(sim) + print(squelch) + except: callsign = "AMSAT" if (debug_mode == 1): From 16190e86a3f95177e8958b9ea5cc419fdd06bcdf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 17:12:24 -0500 Subject: [PATCH 13/49] Update rpitx.py print config --- rpitx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpitx.py b/rpitx.py index 0de9c94c..a8a80a25 100644 --- a/rpitx.py +++ b/rpitx.py @@ -255,6 +255,8 @@ if __name__ == "__main__": callsign = config[0] sim = config[4] squelch = config[5] + print(config) + print print(callsign) print(sim) print(squelch) From 583f19f8b71fe4d95c97935307a3980767432ffc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 11 Nov 2023 17:14:12 -0500 Subject: [PATCH 14/49] Update rpitx.py adjust number --- rpitx.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rpitx.py b/rpitx.py index a8a80a25..3b02eac8 100644 --- a/rpitx.py +++ b/rpitx.py @@ -253,12 +253,10 @@ if __name__ == "__main__": # callsign = file.readline().split(" ")[0] config = file.readline().split(" ") callsign = config[0] - sim = config[4] - squelch = config[5] + squelch = config[10] print(config) print print(callsign) - print(sim) print(squelch) except: From f5d2302bc8a43060c59c70509be40a1a5f68ce61 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 09:28:02 -0500 Subject: [PATCH 15/49] Update rpitx.py turn off command if squelch is 8 --- rpitx.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpitx.py b/rpitx.py index 3b02eac8..2fe777a8 100644 --- a/rpitx.py +++ b/rpitx.py @@ -258,6 +258,11 @@ if __name__ == "__main__": print print(callsign) print(squelch) + if squelch == 8: + print("squelch set to 8, no command input!") + no_command = True + else: + no_command = False except: callsign = "AMSAT" From 239f089660ced5ee70ecd69c4cad883419562dbe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 09:35:28 -0500 Subject: [PATCH 16/49] Update rpitx.py split on whitespace --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 2fe777a8..ad7283d4 100644 --- a/rpitx.py +++ b/rpitx.py @@ -251,7 +251,7 @@ if __name__ == "__main__": try: file = open("/home/pi/CubeSatSim/sim.cfg") # callsign = file.readline().split(" ")[0] - config = file.readline().split(" ") + config = file.readline().split() callsign = config[0] squelch = config[10] print(config) From c0d2fe4c0e2d35c025f119700a68330ff828cf80 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 09:39:58 -0500 Subject: [PATCH 17/49] Update rpitx.py changed to last --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index ad7283d4..149dba69 100644 --- a/rpitx.py +++ b/rpitx.py @@ -253,7 +253,7 @@ if __name__ == "__main__": # callsign = file.readline().split(" ")[0] config = file.readline().split() callsign = config[0] - squelch = config[10] + squelch = config[last] print(config) print print(callsign) From 2831d5cd0e6236b2e74463f74b1770ae1f9dce0b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 09:42:59 -0500 Subject: [PATCH 18/49] Update rpitx.py changed to 5 --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 149dba69..95d14741 100644 --- a/rpitx.py +++ b/rpitx.py @@ -253,7 +253,7 @@ if __name__ == "__main__": # callsign = file.readline().split(" ")[0] config = file.readline().split() callsign = config[0] - squelch = config[last] + squelch = config[5] print(config) print print(callsign) From 04263ca23e0040c7487276de54424051cb32a252 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 09:50:08 -0500 Subject: [PATCH 19/49] Update config fixed -t --- config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config b/config index 40efcb25..5dc1e373 100755 --- a/config +++ b/config @@ -152,7 +152,7 @@ elif [ "$1" = "-t" ]; then echo -# echo $1 $2 $3 $4 +# echo $1 $2 $3 $4 $5 $6 echo "Do you want Simulated Telemetry ON (y/n) " read sim @@ -169,8 +169,8 @@ elif [ "$1" = "-t" ]; then echo echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $1 $2 $3 $4 $sim - echo $1 $2 $3 $4 $sim > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $sim $6 + echo $1 $2 $3 $4 $sim $6 > /home/pi/CubeSatSim/sim.cfg echo echo "Restarting CubeSatSim with new configuraation file" echo From f75502f8cd68a29a1c8febd463e9f2bbdfc57c8d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 10:08:26 -0500 Subject: [PATCH 20/49] Update rpitx.py print no_command --- rpitx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index 95d14741..2fb3409d 100644 --- a/rpitx.py +++ b/rpitx.py @@ -256,14 +256,14 @@ if __name__ == "__main__": squelch = config[5] print(config) print - print(callsign) +# print(callsign) print(squelch) if squelch == 8: print("squelch set to 8, no command input!") no_command = True else: no_command = False - + print(no_command) except: callsign = "AMSAT" if (debug_mode == 1): From a43f47172fc5f63157b089ff905bbad1716b3f6c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 10:13:55 -0500 Subject: [PATCH 21/49] Update rpitx.py changed squelch to sq --- rpitx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpitx.py b/rpitx.py index 2fb3409d..23a81467 100644 --- a/rpitx.py +++ b/rpitx.py @@ -253,12 +253,12 @@ if __name__ == "__main__": # callsign = file.readline().split(" ")[0] config = file.readline().split() callsign = config[0] - squelch = config[5] + sq = config[5] print(config) print # print(callsign) - print(squelch) - if squelch == 8: + print(sq) + if sq == 8: print("squelch set to 8, no command input!") no_command = True else: From e4deee809f029b9798f072641ac473a09fd62f1e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 10:22:10 -0500 Subject: [PATCH 22/49] Update rpitx.py changed 8 to '8' --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 23a81467..5fc26bd7 100644 --- a/rpitx.py +++ b/rpitx.py @@ -258,7 +258,7 @@ if __name__ == "__main__": print # print(callsign) print(sq) - if sq == 8: + if sq == '8': print("squelch set to 8, no command input!") no_command = True else: From 0951067e2905b029dc583fc6eb0d27fe2c9581f5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 12 Nov 2023 10:37:27 -0500 Subject: [PATCH 23/49] Update main.c change back to 434.9 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 7fd336d1..11e31118 100644 --- a/main.c +++ b/main.c @@ -2209,7 +2209,7 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 // mySerial.println("AT+DMOSETGROUP=0,145.0000,145.0000,0,3,0,0\r"); // can change to 145 for testing ASPRS //#else char uhf_string[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n"; - char uhf_string1[] = "AT+DMOSETGROUP=0,435.0000,434.9100,0,"; // changed frequency to verify + char uhf_string1[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,"; // changed frequency to verify char uhf_string2[] = ",0,0\r\n"; char sq_string[2]; sq_string[0] = '0' + squelch; From 4921e95cba8c7323b8958a02162aeac60b065ef7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 15:51:29 -0500 Subject: [PATCH 24/49] Update main.c adding tx rx frequencies --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 11e31118..ba841b77 100644 --- a/main.c +++ b/main.c @@ -152,9 +152,10 @@ int main(int argc, char * argv[]) { // char * cfg_buf[100]; - fscanf(config_file, "%s %d %f %f %s %d", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch); + fscanf(config_file, "%s %d %f %f %s %d %s %s", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx); fclose(config_file); - printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d\n", call, reset_count, lat_file, long_file, sim_yes, squelch); + 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); 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)) { @@ -298,7 +299,7 @@ int main(int argc, char * argv[]) { } */ config_file = fopen("sim.cfg", "w"); - fprintf(config_file, "%s %d %8.4f %8.4f %s %d", call, reset_count, lat_file, long_file, sim_yes, squelch); + 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", call, reset_count); fclose(config_file); config_file = fopen("sim.cfg", "r"); From 3cf2791e480af0034310d3f1b0923ad9ab7d0423 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 15:52:21 -0500 Subject: [PATCH 25/49] Update main.h adding tx rx --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 5b5bdf7d..8495cc54 100644 --- a/main.h +++ b/main.h @@ -124,6 +124,7 @@ long int uptime; char call[5]; char sim_yes[10]; int squelch = 3; // default squelch +char rx[12], tx[12]; int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; From 263deb3766d195f4f9d9f944dfb301f99f05b551 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:03:06 -0500 Subject: [PATCH 26/49] Update config adding -F change rx and tx frequency --- config | 90 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/config b/config index 5dc1e373..07a29287 100755 --- a/config +++ b/config @@ -55,7 +55,7 @@ if [ "$1" = "" ]; then echo -e "Current sim.cfg configuration file:" echo - echo $1 $2 $3 $4 $5 $6 + echo $1 $2 $3 $4 $5 $6 $7 $8 echo echo "To change, include an OPTION" @@ -130,6 +130,7 @@ elif [ "$1" = "-h" ]; then echo " -T Change command state" echo " -R Change the Commands Count in the file command_count.txt" echo " -q Change the Squelch setting for command receiver" + echo " -F Change the rx and tx frequency" echo exit @@ -152,7 +153,7 @@ elif [ "$1" = "-t" ]; then echo -# echo $1 $2 $3 $4 $5 $6 +# echo $1 $2 $3 $4 $5 $6 $7 $8 echo "Do you want Simulated Telemetry ON (y/n) " read sim @@ -169,8 +170,8 @@ elif [ "$1" = "-t" ]; then echo echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $1 $2 $3 $4 $sim $6 - echo $1 $2 $3 $4 $sim $6 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $sim $6 $7 $8 + echo $1 $2 $3 $4 $sim $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg echo echo "Restarting CubeSatSim with new configuraation file" echo @@ -195,7 +196,7 @@ elif [ "$1" = "-c" ]; then echo $1 echo -# echo $1 $2 $3 $4 $5 $6 +# echo $1 $2 $3 $4 $5 $6 $7 $8 echo "Enter callsign in all capitals: " read callsign @@ -209,8 +210,8 @@ elif [ "$1" = "-c" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 $6 - echo $callsign $2 $3 $4 $5 $6 > /home/pi/CubeSatSim/sim.cfg + echo $callsign $2 $3 $4 $5 $6 $7 $8 + echo $callsign $2 $3 $4 $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -241,7 +242,7 @@ elif [ "$1" = "-r" ]; then echo $2 echo -# echo $1 $2 $3 $4 $5 $6 +# echo $1 $2 $3 $4 $5 $6 $7 $8 echo -e "Enter Reset Count (integer): " @@ -261,8 +262,8 @@ elif [ "$1" = "-r" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $resets $3 $4 $5 $6 - echo $1 $resets $3 $4 $5 $6 > /home/pi/CubeSatSim/sim.cfg + echo $1 $resets $3 $4 $5 $6 $7 $8 + echo $1 $resets $3 $4 $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg fi if [ "$norestart" = "1" ]; then @@ -294,7 +295,7 @@ elif [ "$1" = "-l" ]; then echo $3 echo -# echo $1 $2 $3 $4 $5 $6 +# echo $1 $2 $3 $4 $5 $6 $7 $8 echo -e "Enter latitude (decimal degrees, positive is north): " @@ -336,8 +337,8 @@ elif [ "$1" = "-l" ]; then fi echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $1 $2 $lat $long $5 $6 - echo $1 $2 $lat $long $5 $6 > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $lat $long $5 $6 $7 $8 + echo $1 $2 $lat $long $5 $6 $7 $8 > /home/pi/CubeSatSim/sim.cfg if [ "$norestart" = "1" ]; then echo @@ -441,7 +442,7 @@ elif [ "$1" = "-q" ]; then echo $6 echo -# echo $1 $2 $3 $4 $5 $6 +# echo $1 $2 $3 $4 $5 $6 $7 $8 echo -e "Enter squelch (integer 0 - 8): " @@ -463,14 +464,71 @@ elif [ "$1" = "-q" ]; then echo echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" echo - echo $1 $2 $3 $4 $5 $sq - echo $1 $2 $3 $4 $4 $sq > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $sq $7 $8 + echo $1 $2 $3 $4 $4 $sq $7 $8 > /home/pi/CubeSatSim/sim.cfg echo echo "Restarting CubeSatSim with new configuraation file" echo sudo systemctl restart cubesatsim + +elif [ "$1" = "-F" ]; then + + echo + echo "Editing the tx and rx frequency in the" + echo "configuration file for CubeSatSim" + echo + echo "Return keeps current value." +# echo -e "Current sim.cfg configuration file:" +# echo + + value=`cat /home/pi/CubeSatSim/sim.cfg` + echo "$value" > /dev/null + set -- $value + + echo "Current value of tx is" + echo $7 + echo + echo "Current value of rx is" + echo $8 + echo + +# echo $1 $2 $3 $4 $5 $6 $7 $8 + + echo "Enter tx frequency as 4XX.XXXX: " + read tx + + if [ -z $tx ] ; then + + tx="$7" + echo "Keeping value of" $tx + fi + + echo "Enter rx frequency as 4XX.XXXX: " + read rx + + if [ -z $rx ] ; then + + rx="$8" + echo "Keeping value of" $rx + +# else + 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 + fi + +# if [ "$norestart" = "1" ]; then +# echo +# else + echo + echo "Restarting CubeSatSim with new configuraation file" + echo + sudo systemctl restart cubesatsim +# fi + fi # sudo systemctl restart cubesatsim From dae91105a1bba33b35cc9441095a54285b8a1b06 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:11:39 -0500 Subject: [PATCH 27/49] Update config update config --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index 07a29287..8e0bec00 100755 --- a/config +++ b/config @@ -517,7 +517,7 @@ elif [ "$1" = "-F" ]; 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 $tx $rx > /home/pi/CubeSatSim/sim.cfg fi # if [ "$norestart" = "1" ]; then From 0ce4735487a5240ea22e10e24d0e9fb0bad75370 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:13:17 -0500 Subject: [PATCH 28/49] Update config update for real --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index 8e0bec00..aefd8757 100755 --- a/config +++ b/config @@ -511,14 +511,14 @@ elif [ "$1" = "-F" ]; then rx="$8" echo "Keeping value of" $rx - + fi # else 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 $tx $rx > /home/pi/CubeSatSim/sim.cfg - fi +# fi # if [ "$norestart" = "1" ]; then # echo From fe952653073406e6f871c96831ed3e4aae58c936 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:17:33 -0500 Subject: [PATCH 29/49] Update config display new rx tx --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index aefd8757..63a4a632 100755 --- a/config +++ b/config @@ -516,7 +516,7 @@ elif [ "$1" = "-F" ]; 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 $tx $rx echo $callsign $2 $3 $4 $5 $6 $tx $rx > /home/pi/CubeSatSim/sim.cfg # fi From 7b333c8f499cdfbae1e4382e50b56bf9e54313ea Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:20:21 -0500 Subject: [PATCH 30/49] Update config don't override callsign --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index 63a4a632..26dc1a9d 100755 --- a/config +++ b/config @@ -516,8 +516,8 @@ elif [ "$1" = "-F" ]; then echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n" - echo $callsign $2 $3 $4 $5 $6 $tx $rx - echo $callsign $2 $3 $4 $5 $6 $tx $rx > /home/pi/CubeSatSim/sim.cfg + echo $1 $2 $3 $4 $5 $6 $tx $rx + echo $1 $2 $3 $4 $5 $6 $tx $rx > /home/pi/CubeSatSim/sim.cfg # fi # if [ "$norestart" = "1" ]; then From 9ee32cb03a7ddb17a2470803548b2ec422993779 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:28:33 -0500 Subject: [PATCH 31/49] Update rpitx.py read tx and rx from sim.cfg --- rpitx.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 5fc26bd7..8992f1a8 100644 --- a/rpitx.py +++ b/rpitx.py @@ -253,7 +253,20 @@ if __name__ == "__main__": # callsign = file.readline().split(" ")[0] config = file.readline().split() callsign = config[0] - sq = config[5] + if len(config) > 5: + sq = config[5] + else: + sq = '0' + if len(config) > 6: + tx = config[6] + print(tx) + else: + tx = '434.9000' + if len(config) > 7: + rx = config[7] + print(rx) + else: + rx = '435.0000' print(config) print # print(callsign) From 05bde2ada4e177bc3855c03f6a9ad90e95050f06 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:33:00 -0500 Subject: [PATCH 32/49] Update rpitx.py force CW ID rpitx using tx --- rpitx.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index 8992f1a8..19956033 100644 --- a/rpitx.py +++ b/rpitx.py @@ -187,6 +187,7 @@ txc = False if GPIO.input(7) == False: print("TXC is present") txc = True; + txc = False; else: print("TXC not present") output(txLed, txLedOn) @@ -301,9 +302,11 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") else: if (debug_mode == 1): - system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && 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 434.9e3") +# system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && 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 434.9e3") + system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && 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("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && 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 434.9e3 > /dev/null 2>&1") +# system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && 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 434.9e3 > /dev/null 2>&1") + system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && 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) output(txLed, txLedOff) From ab62d1df72cf6df0a91c6bb246714cc51c25527f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:40:55 -0500 Subject: [PATCH 33/49] Update rpitx.py add tx for BPSK --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 19956033..418da492 100644 --- a/rpitx.py +++ b/rpitx.py @@ -721,7 +721,8 @@ if __name__ == "__main__": output(pd, 1) output(ptt, 1) if (command_tx == True): - system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") +# system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") + system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") print("Turning LED on/off and listening for carrier") while 1: output(txLed, txLedOff) From e48a5880bec53ba025e1f68953b4ce866d11cecc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:45:37 -0500 Subject: [PATCH 34/49] Update rpitx.py FSK and BPSK use tx, force txc off --- rpitx.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rpitx.py b/rpitx.py index 418da492..ccd77162 100644 --- a/rpitx.py +++ b/rpitx.py @@ -187,7 +187,6 @@ txc = False if GPIO.input(7) == False: print("TXC is present") txc = True; - txc = False; else: print("TXC not present") output(txLed, txLedOn) @@ -754,7 +753,7 @@ if __name__ == "__main__": if (command_tx == True): print("Turning on transmit") system("echo > command_tx True") - system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &") + system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") else: print("Turning off transmit") # and rebooting") system("echo > command_tx False") @@ -770,7 +769,7 @@ if __name__ == "__main__": output(pd, 1) output(ptt, 1) if (command_tx == True): - system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 &") + system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 &") print("Turning LED on/off and listening for carrier") while 1: output(txLed, txLedOff) @@ -802,7 +801,7 @@ if __name__ == "__main__": if (command_tx == True): print("Turning on transmit") system("echo > command_tx True") - system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 &") + system("sudo nc -l 8080 | 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: print("Turning of transmit and rebooting") system("echo > command_tx False") From f40f703f6c126647f7136d861e86767723230f30 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:50:16 -0500 Subject: [PATCH 35/49] Update rpitx.py change all 434.9 to tx --- rpitx.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/rpitx.py b/rpitx.py index ccd77162..684311c1 100644 --- a/rpitx.py +++ b/rpitx.py @@ -347,9 +347,9 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/telem.wav") else: if (debug_mode == 1): - system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") + system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.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("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") + system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.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) output (ptt, 1) @@ -416,9 +416,9 @@ if __name__ == "__main__": system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") else: if (debug_mode == 1): - system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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 434.9e3") + system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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 434.9e3 > /dev/null 2>&1") + system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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) @@ -468,9 +468,9 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") else: if (debug_mode == 1): - system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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 434.9e3") + system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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 434.9e3 > /dev/null 2>&1") + system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && 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) output(txLed, txLedOff) @@ -518,9 +518,9 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav") else: if (debug_mode == 1): - system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") + system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") else: - system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") + system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff) output (ptt, 1) @@ -601,9 +601,9 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/camera_out.jpg.wav") else: if (debug_mode == 1): - system("cat /home/pi/CubeSatSim/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") + system("cat /home/pi/CubeSatSim/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") else: - system("cat /home/pi/CubeSatSim/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") + system("cat /home/pi/CubeSatSim/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff) output (ptt, 1) @@ -627,9 +627,9 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav") else: if (debug_mode == 1): - system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") + system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") else: - system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") + system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff) output (ptt, 1) @@ -685,9 +685,9 @@ if __name__ == "__main__": system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav") else: if (debug_mode == 1): - system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") + system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3") else: - system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") + system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff) output (ptt, 1) @@ -697,7 +697,7 @@ if __name__ == "__main__": print("image 2 did not load - copy from CubeSatSim/sstv directory") if (txc == False): if (command_tx == True): - system("(while true; do (sleep 5 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3 &") + system("(while true; do (sleep 5 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &") while 1: if (command_tx == True): From 19a0745b8ab92a2a7ac711e6c3d855d0fc1e26b8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 16:57:49 -0500 Subject: [PATCH 36/49] Update main.c set FM to tx and rx --- main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index ba841b77..206bbb37 100644 --- a/main.c +++ b/main.c @@ -2210,13 +2210,20 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 // mySerial.println("AT+DMOSETGROUP=0,145.0000,145.0000,0,3,0,0\r"); // can change to 145 for testing ASPRS //#else char uhf_string[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n"; + char uhf_string1a[] = "AT+DMOSETGROUP=0,"; // changed frequency to verify + char comma[] = ","; + char uhf_string1b[] = ",0,"; // changed frequency to verify char uhf_string1[] = "AT+DMOSETGROUP=0,435.0000,434.9000,0,"; // changed frequency to verify char uhf_string2[] = ",0,0\r\n"; char sq_string[2]; sq_string[0] = '0' + squelch; sq_string[1] = 0; // serialPrintf(uart_fd, uhf_string); - serialPrintf(uart_fd, uhf_string1); + serialPrintf(uart_fd, uhf_string1a); + serialPrintf(uart_fd, tx); + serialPrintf(uart_fd, comma); + serialPrintf(uart_fd, rx); + serialPrintf(uart_fd, uhf_string1b); serialPrintf(uart_fd, sq_string); serialPrintf(uart_fd, uhf_string2); From 625d740308393b051eaa3458c3fefd4ed5d7091d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:03:25 -0500 Subject: [PATCH 37/49] Update main.c print tx and rx --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 206bbb37..2f3ce8a4 100644 --- a/main.c +++ b/main.c @@ -156,6 +156,9 @@ int main(int argc, char * argv[]) { 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("==%s==%s==\n", tx, rx); + 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)) { From 4fdda4c1c3cd5f6e4c6bd86ad55652695e650cc8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:07:55 -0500 Subject: [PATCH 38/49] Update main.c move program_radio() --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 2f3ce8a4..2fad1886 100644 --- a/main.c +++ b/main.c @@ -46,9 +46,7 @@ int main(int argc, char * argv[]) { printf("\n\nCubeSatSim v1.3b starting...\n\n"); wiringPiSetup(); - - program_radio(); - + // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); @@ -159,6 +157,8 @@ int main(int argc, char * argv[]) { printf("==%s==%s==\n", tx, rx); + program_radio(); + 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)) { From c52d0f9666635e881961daa659aa1e1ece1ad6c7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:20:11 -0500 Subject: [PATCH 39/49] Update main.c basic program_radio --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 2fad1886..2ca7190f 100644 --- a/main.c +++ b/main.c @@ -2221,7 +2221,9 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 char sq_string[2]; sq_string[0] = '0' + squelch; sq_string[1] = 0; -// serialPrintf(uart_fd, uhf_string); + + serialPrintf(uart_fd, uhf_string); +/* serialPrintf(uart_fd, uhf_string1a); serialPrintf(uart_fd, tx); serialPrintf(uart_fd, comma); @@ -2229,6 +2231,7 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 serialPrintf(uart_fd, uhf_string1b); serialPrintf(uart_fd, sq_string); serialPrintf(uart_fd, uhf_string2); +*/ // mySerial.println("AT+DMOSETGROUP=0,435.1000,434.9900,0,3,0,0\r"); // squelch set to 3 //#endif From cff2f123eb9531069739e4c534d2bc347dfe98a7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:24:27 -0500 Subject: [PATCH 40/49] Update main.c move program_radio back to start --- main.c | 88 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/main.c b/main.c index 2ca7190f..e3a71d2b 100644 --- a/main.c +++ b/main.c @@ -45,7 +45,50 @@ int main(int argc, char * argv[]) { printf("\n\nCubeSatSim v1.3b starting...\n\n"); - wiringPiSetup(); + // Open configuration file with callsign and reset count + FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r"); + if (config_file == NULL) { + printf("Creating config file."); + config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "w"); + fprintf(config_file, "%s %d", " ", 100); + fclose(config_file); + config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r"); + } + +// 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); + 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("==%s==%s==\n", tx, rx); + + program_radio(); + + 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"); +// 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)); + newGpsTime = millis(); + + } else { // set default +// latitude = toAprsFormat(latitude); +// longitude = toAprsFormat(longitude); + newGpsTime = millis(); + } + + if (strcmp(sim_yes, "yes") == 0) + sim_mode = TRUE; + + wiringPiSetup(); // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); @@ -137,49 +180,6 @@ int main(int argc, char * argv[]) { fclose(telem_file); printf("Opened telem file\n"); - - // Open configuration file with callsign and reset count - FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r"); - if (config_file == NULL) { - printf("Creating config file."); - config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "w"); - fprintf(config_file, "%s %d", " ", 100); - fclose(config_file); - config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r"); - } - -// 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); - 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("==%s==%s==\n", tx, rx); - - program_radio(); - - 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"); -// 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)); - newGpsTime = millis(); - - } else { // set default -// latitude = toAprsFormat(latitude); -// longitude = toAprsFormat(longitude); - newGpsTime = millis(); - } - - if (strcmp(sim_yes, "yes") == 0) - sim_mode = TRUE; if (mode == AFSK) { From b8d4f5ea49a3e0478f68d891e449c0d7522f1a5a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:28:05 -0500 Subject: [PATCH 41/49] Update main.c back to normal programradio --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index e3a71d2b..d515a214 100644 --- a/main.c +++ b/main.c @@ -2222,8 +2222,8 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 sq_string[0] = '0' + squelch; sq_string[1] = 0; - serialPrintf(uart_fd, uhf_string); -/* +// serialPrintf(uart_fd, uhf_string); +/**/ serialPrintf(uart_fd, uhf_string1a); serialPrintf(uart_fd, tx); serialPrintf(uart_fd, comma); @@ -2231,7 +2231,7 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 serialPrintf(uart_fd, uhf_string1b); serialPrintf(uart_fd, sq_string); serialPrintf(uart_fd, uhf_string2); -*/ +/**/ // mySerial.println("AT+DMOSETGROUP=0,435.1000,434.9900,0,3,0,0\r"); // squelch set to 3 //#endif From b95b42c7ee932ae16293be5df7b73b9b1b609da4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:29:35 -0500 Subject: [PATCH 42/49] Update main.c move wiring pi setup --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d515a214..8832e6cf 100644 --- a/main.c +++ b/main.c @@ -45,6 +45,8 @@ int main(int argc, char * argv[]) { printf("\n\nCubeSatSim v1.3b starting...\n\n"); + wiringPiSetup(); + // Open configuration file with callsign and reset count FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r"); if (config_file == NULL) { @@ -88,8 +90,6 @@ int main(int argc, char * argv[]) { if (strcmp(sim_yes, "yes") == 0) sim_mode = TRUE; - wiringPiSetup(); - // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); From 7ed88f97750ea88d5cc979c14e9a444400f6f3d4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 13 Nov 2023 17:32:16 -0500 Subject: [PATCH 43/49] Update main.c swapped rx and tx --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8832e6cf..318c8eaa 100644 --- a/main.c +++ b/main.c @@ -2225,9 +2225,9 @@ if ((uart_fd = serialOpen("/dev/ttyAMA0", 9600)) >= 0) { // was 9600 // serialPrintf(uart_fd, uhf_string); /**/ serialPrintf(uart_fd, uhf_string1a); - serialPrintf(uart_fd, tx); - serialPrintf(uart_fd, comma); serialPrintf(uart_fd, rx); + serialPrintf(uart_fd, comma); + serialPrintf(uart_fd, tx); serialPrintf(uart_fd, uhf_string1b); serialPrintf(uart_fd, sq_string); serialPrintf(uart_fd, uhf_string2); From ecb01928c8e7387fa53e7cf8cd3471423fbad1da Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 14 Nov 2023 08:44:30 -0500 Subject: [PATCH 44/49] Update main.c disable program radio - do in rpitx.py instead --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 318c8eaa..4f7878cd 100644 --- a/main.c +++ b/main.c @@ -64,9 +64,9 @@ int main(int argc, char * argv[]) { 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("==%s==%s==\n", tx, rx); + printf("Transmit on %s Receive on %s\n", tx, rx); - program_radio(); +// program_radio(); // do in rpitx instead reset_count = (reset_count + 1) % 0xffff; From 4a518700c7899ee05f0d08679a7d6abebf95b055 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 14 Nov 2023 08:58:29 -0500 Subject: [PATCH 45/49] Update rpitx.py added program radio --- rpitx.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rpitx.py b/rpitx.py index 684311c1..200a2533 100644 --- a/rpitx.py +++ b/rpitx.py @@ -9,6 +9,7 @@ from time import sleep import sys from os import system from PIL import Image, ImageDraw, ImageFont, ImageColor +import serial def increment_mode(): print("increment mode") @@ -285,6 +286,19 @@ if __name__ == "__main__": print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT) + + print("Programming FM module!\n"); + output(pd, 1) + output (ptt, 1) + + ser = serial.Serial("/dev/ttyAMA0", 9600) + print(ser.portstr) + for i in range(6): + ser.write("AT+DMOSETGROUP=0,435.0000,434.9100,0,3,0,0\r\n") + sleep(0.1) + ser.close() + + output(pd, 0) sleep(10) # delay so cubesatsim code catches up From 2ff39ec7f7984c2bc8addcdc50ee5dd17f7b8bcf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 14 Nov 2023 09:05:10 -0500 Subject: [PATCH 46/49] Update rpitx.py change to bytes --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 200a2533..37da585b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -294,7 +294,7 @@ if __name__ == "__main__": ser = serial.Serial("/dev/ttyAMA0", 9600) print(ser.portstr) for i in range(6): - ser.write("AT+DMOSETGROUP=0,435.0000,434.9100,0,3,0,0\r\n") + ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9100,0,3,0,0\r\n") sleep(0.1) ser.close() From ef73a3cebc259079aef90fa4d464a2418eee4762 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 14 Nov 2023 09:07:50 -0500 Subject: [PATCH 47/49] Update rpitx.py add try for serial --- rpitx.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rpitx.py b/rpitx.py index 37da585b..cd1b7184 100644 --- a/rpitx.py +++ b/rpitx.py @@ -291,11 +291,14 @@ if __name__ == "__main__": output(pd, 1) output (ptt, 1) - ser = serial.Serial("/dev/ttyAMA0", 9600) - print(ser.portstr) - for i in range(6): - ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9100,0,3,0,0\r\n") - sleep(0.1) + try: + ser = serial.Serial("/dev/ttyAMA0", 9600) + print(ser.portstr) + for i in range(6): + ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9200,0,3,0,0\r\n") + sleep(0.1) + except: + print("Error in serial write") ser.close() output(pd, 0) From a0b8119ffdbd4a6ef24d021a12997b34a564b0bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 14 Nov 2023 09:10:17 -0500 Subject: [PATCH 48/49] Update rpitx.py with tx and rx --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index cd1b7184..7b912aa5 100644 --- a/rpitx.py +++ b/rpitx.py @@ -295,7 +295,8 @@ if __name__ == "__main__": ser = serial.Serial("/dev/ttyAMA0", 9600) print(ser.portstr) for i in range(6): - ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9200,0,3,0,0\r\n") +# ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") + ser.write(b"AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n") sleep(0.1) except: print("Error in serial write") From eb291934bdf46b5328206be375d9d411475438f2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 14 Nov 2023 09:13:58 -0500 Subject: [PATCH 49/49] Update rpitx.py fix string to bytes --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 7b912aa5..6127ffce 100644 --- a/rpitx.py +++ b/rpitx.py @@ -294,9 +294,10 @@ if __name__ == "__main__": try: ser = serial.Serial("/dev/ttyAMA0", 9600) print(ser.portstr) + uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" for i in range(6): # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") - ser.write(b"AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n") + ser.write(uhf_string.encode()) sleep(0.1) except: print("Error in serial write")