From a090f88db65f4188e807434d419d48e8c1bbc7b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 10:57:00 -0400 Subject: [PATCH 01/17] Update main.c remove checks --- main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 3d40f63e..52317bd2 100644 --- a/main.c +++ b/main.c @@ -278,9 +278,15 @@ int main(int argc, char * argv[]) { pclose(file); } - txLed = 0; // defaults for vB3 board without TFB - txLedOn = LOW; - txLedOff = HIGH; + txLed = 2; + txLedOn = HIGH; + txLedOff = LOW; + vB5 = TRUE; + onLed = 27; + onLedOn = HIGH; + onLedOff = LOW; + transmit = TRUE; +/* if (!ax5043) { pinMode(2, INPUT); pullUpDnControl(2, PUD_UP); @@ -344,6 +350,7 @@ int main(int argc, char * argv[]) { } } } + */ // pinMode(txLed, OUTPUT); // digitalWrite(txLed, txLedOff); #ifdef DEBUG_LOGGING From 8a0f9041a4ca7492ded06cec57cf52ef58deb808 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:01:06 -0400 Subject: [PATCH 02/17] Update main.c add back LPF check --- main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 52317bd2..9b55bd0c 100644 --- a/main.c +++ b/main.c @@ -285,7 +285,15 @@ int main(int argc, char * argv[]) { onLed = 27; onLedOn = HIGH; onLedOff = LOW; - transmit = TRUE; + + + pinMode(26, INPUT); + pullUpDnControl(26, PUD_UP); + + if (digitalRead(26) != HIGH) { + printf("v1 Present with UHF BPF\n"); + transmit = TRUE; + } /* if (!ax5043) { pinMode(2, INPUT); From 592dcd5a753036759d3de29c4cfa1aacc7cda5a4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:04:32 -0400 Subject: [PATCH 03/17] Update main.c changed band to low --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 9b55bd0c..1320ee83 100644 --- a/main.c +++ b/main.c @@ -493,7 +493,7 @@ int main(int argc, char * argv[]) { if (transmit == FALSE) { - fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n"); + fprintf(stderr, "\nNo CubeSatSim Low Pass Filter detected. No transmissions after the CW ID.\n"); fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n"); } From ab3d7815dbb69d457c20fbddf0bfa53c1cdf6aec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:06:36 -0400 Subject: [PATCH 04/17] Update rpitx.py change check and BPF to LPF --- rpitx.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/rpitx.py b/rpitx.py index 9f6acaf6..a0bc5d6e 100644 --- a/rpitx.py +++ b/rpitx.py @@ -157,30 +157,15 @@ GPIO.setup(green, GPIO.OUT) GPIO.output(powerPin, 1) transmit = False +txLed = 27 +txLedOn = 1 +txLedOff = 0 if GPIO.input(12) == False: - print("Version is v1 with UHF BPF") + print("Version is v1 with UHF LPF") transmit = True - txLed = 27 - txLedOn = 1 - txLedOff = 0 -elif GPIO.input(27) == False: - print("Version is TFB") - transmit = True - txLed = 22 - txLedOn = 0 - txLedOff = 1 -elif GPIO.input(13) == False: - print("Version is v1 with VHF BPF") - print("VHF transmit not imemented yet") -# transmit = True - txLed = 27 - txLedOn = 1 - txLedOff = 0 else: - print("No BPF") - txLed = 27 - txLedOn = 1 - txLedOff = 0 + print("No LPF") + # GPIO.setup(txLed, GPIO.OUT) # output(txLed, txLedOff) From 49e0b2cad991d344f9ad791c3e356cbed92a7c67 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:08:11 -0400 Subject: [PATCH 05/17] Update rpitx.py last BPF --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index a0bc5d6e..704d6eb9 100644 --- a/rpitx.py +++ b/rpitx.py @@ -817,6 +817,6 @@ if __name__ == "__main__": # print(txLedOn) sleep(4.2) else: - print("No Low Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the BPF.") + print("No Low Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the LPF.") while 1: sleep(5) From 372e1af22ddb64d7a4855a414d2bffd13bca850b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:22:56 -0400 Subject: [PATCH 06/17] Update main.c change to detecting Pi Zero or not --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 1320ee83..09bb45fd 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,7 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000c1'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); @@ -39,10 +39,10 @@ int main(int argc, char * argv[]) { fprintf(stderr, " %x ", resbuffer[0]); fprintf(stderr, " %x \n", resbuffer[1]); - if ((resbuffer[0] == '9') && (resbuffer[1] == '0')) + if ((resbuffer[0] != '9') || (resbuffer[1] != '0')) { // voltageThreshold = 3.7; - fprintf(stderr, "Pi Zero 2 detected\n"); + fprintf(stderr, "Pi Zero not detected (could be Pi Zero 2)\n"); pi_zero_2_offset = 500; if (uptime_sec < 30.0) { FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); From b6a480d4d22806611afd820105e577a0b3887c17 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:42:21 -0400 Subject: [PATCH 07/17] Update main.c detect Pi Zero or Pi Zero W --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 09bb45fd..8b343a7b 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,7 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000c1'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); From 960c763df284a06ea1ec7c5255c870e7b24c9163 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:50:32 -0400 Subject: [PATCH 08/17] Update main.c fix camera test --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8b343a7b..bc3e5ca6 100644 --- a/main.c +++ b/main.c @@ -414,7 +414,7 @@ int main(int argc, char * argv[]) { char camera_present[] = "supported=1 detected=1"; // printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present)); camera = (strstr( (const char *)& cmdbuffer, camera_present) != NULL) ? ON : OFF; - // printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); + printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); pclose(file4); #ifdef DEBUG_LOGGING @@ -422,7 +422,7 @@ int main(int argc, char * argv[]) { #endif FILE * file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1", "r"); - file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1", "r"); + //file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1", "r"); pclose(file5); if (!ax5043) // don't test for payload if AX5043 is present From 4d7cc5041056473aa73ae6e0760272ba41454e12 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 11:51:49 -0400 Subject: [PATCH 09/17] Update main.c camera fix --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index bc3e5ca6..68ad9833 100644 --- a/main.c +++ b/main.c @@ -414,7 +414,7 @@ int main(int argc, char * argv[]) { char camera_present[] = "supported=1 detected=1"; // printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present)); camera = (strstr( (const char *)& cmdbuffer, camera_present) != NULL) ? ON : OFF; - printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera); + printf("Camera result:%s camera: %d \n", & cmdbuffer, camera); pclose(file4); #ifdef DEBUG_LOGGING From bf3f114582c6c001ca67e0e2212fc7e607b96f25 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 12:04:25 -0400 Subject: [PATCH 10/17] Update main.c change to 9000 for Pi Zero test --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 68ad9833..15a31e6d 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,8 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; +// const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); @@ -39,7 +40,7 @@ int main(int argc, char * argv[]) { fprintf(stderr, " %x ", resbuffer[0]); fprintf(stderr, " %x \n", resbuffer[1]); - if ((resbuffer[0] != '9') || (resbuffer[1] != '0')) + if ((resbuffer[0] != '9') || (resbuffer[1] != '0') || (resbuffer[2] != '0') || (resbuffer[3] != '0')) { // voltageThreshold = 3.7; fprintf(stderr, "Pi Zero not detected (could be Pi Zero 2)\n"); From 387d878b774dfc4f644f2b5f442ff7bf1ba6b8c0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:43:01 -0400 Subject: [PATCH 11/17] Update dtmf_aprs_cc.py change -o to use config --- dtmf_aprs_cc.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index a77a65b0..063c26bd 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -47,20 +47,22 @@ if __name__ == "__main__": change_mode = True if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): system("echo '\nBeacon Mode toggle!!\n'") - try: - fm = open("/home/pi/CubeSatSim/beacon_off") - fm.close() - system("echo 'Beacon is off, turning it ON'") - system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") - except: - system("echo 'Beacon is on, turning it OFF'") - system("touch /home/pi/CubeSatSim/beacon_off") - - system("echo 'Restarting rpitx'") - system("sudo systemctl restart rpitx") -# system("echo 'Resuming rpitx'") -# system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") - change_mode = False + mode = 'o' + change_mode = True +# try: +# fm = open("/home/pi/CubeSatSim/beacon_off") +# fm.close() +# system("echo 'Beacon is off, turning it ON'") +# system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") +# except: +# system("echo 'Beacon is on, turning it OFF'") +# system("touch /home/pi/CubeSatSim/beacon_off") +# +# system("echo 'Restarting rpitx'") +# system("sudo systemctl restart rpitx") +## system("echo 'Resuming rpitx'") +## system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") +# change_mode = False if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 1a8d40965db28bce3e7b0cf09e6b58d9f1861af6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:48:06 -0400 Subject: [PATCH 12/17] Update dtmf_aprs_cc.py fix APRS force --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 063c26bd..8abe7c49 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -132,7 +132,7 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) - else: + elseif: mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) From cdf25da3557ecd89cc432456d2529d6c1cdfccb8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:49:02 -0400 Subject: [PATCH 13/17] Update dtmf_aprs_cc.py else if typo --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 8abe7c49..cbf65aad 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -132,7 +132,7 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) - elseif: + elif: mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) From 082d396171858726dd353efb841ec02b76c47bd9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 17:51:08 -0400 Subject: [PATCH 14/17] Update dtmf_aprs_cc.py fix else --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index cbf65aad..6a2a23f8 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -132,7 +132,7 @@ if __name__ == "__main__": sleep(0.1) GPIO.output(powerPin, 1) sleep(1) - elif: + elif (mode == 'a'): mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) From 665602b6075dffaf5a05c0c8164a5ddba5a0d5ec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 30 Jul 2024 19:19:38 -0400 Subject: [PATCH 15/17] Update dtmf_aprs_cc.py skip every other command --- dtmf_aprs_cc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 6a2a23f8..c402eed8 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -12,6 +12,7 @@ if __name__ == "__main__": txLed = 27 change_mode = False debug_mode = False + counter = 0 if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): @@ -63,7 +64,8 @@ if __name__ == "__main__": ## system("echo 'Resuming rpitx'") ## system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") # change_mode = False - if (debug_mode == False) and (change_mode == True): + counter = (counter + 1) % 2 + if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other command since Direwolf prints them twice GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) From 0a2915ea799896f1a9f33f589f753c0e0b8637cb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 00:05:28 -0400 Subject: [PATCH 16/17] Update dtmf_aprs_cc.py add counter to ignore duplicate APRS message --- dtmf_aprs_cc.py | 58 +++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index c402eed8..8bd638ee 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -12,7 +12,7 @@ if __name__ == "__main__": txLed = 27 change_mode = False debug_mode = False - counter = 0 + counter = 1 if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): @@ -26,46 +26,58 @@ if __name__ == "__main__": # if '^c' == line.rstrip(): # break - if ((line.find("MODE=a")) > 0) or ((line.find("DTMF>APDW15:t1#")) > 0): + if ((line.find("MODE=a")) > 0): system("echo '\nAPRS Mode!!\n'") mode = 'a' change_mode = True - if ((line.find("MODE=f")) > 0) or ((line.find("DTMF>APDW15:t2#")) > 0): + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t1#")) > 0): + system("echo '\nAPRS Mode!!\n'") + mode = 'a' + change_mode = True + if ((line.find("MODE=f")) > 0): + system("echo '\nFSK Mode!!\n'") + mode = 'f' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t2#")) > 0): system("echo '\nFSK Mode!!\n'") mode = 'f' change_mode = True - if ((line.find("MODE=b")) > 0) or ((line.find("DTMF>APDW15:t3#")) > 0): + if ((line.find("MODE=b")) > 0): + system("echo '\nBPSK Mode!!\n'") + mode = 'b' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t3#")) > 0): system("echo '\nBPSK Mode!!\n'") mode = 'b' change_mode = True - if ((line.find("MODE=s")) > 0) or ((line.find("DTMF>APDW15:t4#")) > 0): + if ((line.find("MODE=s")) > 0): + system("echo '\nSSTV Mode!!\n'") + mode = 's' + change_mode = True + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t4#")) > 0): system("echo '\nSSTV Mode!!\n'") mode = 's' change_mode = True - if ((line.find("MODE=m")) > 0) or ((line.find("DTMF>APDW15:t5#")) > 0): + if ((line.find("MODE=m")) > 0): system("echo '\nCW Mode!!\n'") mode = 'm' change_mode = True - if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0): + counter = (counter + 1) % 2 + if ((line.find("MODE=o")) > 0): system("echo '\nBeacon Mode toggle!!\n'") mode = 'o' change_mode = True -# try: -# fm = open("/home/pi/CubeSatSim/beacon_off") -# fm.close() -# system("echo 'Beacon is off, turning it ON'") -# system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1") -# except: -# system("echo 'Beacon is on, turning it OFF'") -# system("touch /home/pi/CubeSatSim/beacon_off") -# -# system("echo 'Restarting rpitx'") -# system("sudo systemctl restart rpitx") -## system("echo 'Resuming rpitx'") -## system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1") -# change_mode = False - counter = (counter + 1) % 2 - if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other command since Direwolf prints them twice + counter = (counter + 1) % 2 + if ((line.find("DTMF>APDW15:t10#")) > 0): + system("echo '\nBeacon Mode toggle!!\n'") + mode = 'o' + change_mode = True + + if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) From 749747b00d2c61e83a58e89012de9f8bbb66c9e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 31 Jul 2024 08:42:34 -0400 Subject: [PATCH 17/17] Update dtmf_aprs_cc.py don't stop CubeSatSim --- dtmf_aprs_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py index 8bd638ee..c1b67831 100644 --- a/dtmf_aprs_cc.py +++ b/dtmf_aprs_cc.py @@ -172,7 +172,7 @@ if __name__ == "__main__": GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") - system("sudo systemctl stop cubesatsim") +# system("sudo systemctl stop cubesatsim") print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode)