From 45b18c5050a9b1e356f732e0260bcd3bf7b41581 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 11:58:07 -0400 Subject: [PATCH 001/125] Update aprs_in.py increment command_count --- aprs_in.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 83331bd6..e696bb6d 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -38,6 +38,22 @@ if __name__ == "__main__": mode = 'm' change_mode = True if (debug_mode == False) and (change_mode == True): + try: + file = open("/home/pi/CubeSatSim/command_count.txt", "r") + string = file.read() + file.close() + command_count = int(string) + command_count += 1 + filec = open("/home/pi/CubeSatSim/command_count.txt", "w") + command_count_string = str(command_count) + print(command_count_string) + string = filec.write(command_count_string) + filec.close() + except: + print("Can't write command_count file!") + print("Command_count: ") + print(command_count) + print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) change_mode = False From 19c87b04f0afb4c63c4ef6045eb10bf07aee0999 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:34:23 -0400 Subject: [PATCH 002/125] Create squelch_cc.py code moved from spitx.py --- squelch_cc.py | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 squelch_cc.py diff --git a/squelch_cc.py b/squelch_cc.py new file mode 100644 index 00000000..4a28f8c8 --- /dev/null +++ b/squelch_cc.py @@ -0,0 +1,165 @@ +import RPi.GPIO as GPIO +from RPi.GPIO import output + +def command_control_check(): + +# global command_control +# global no_command +# global debug_mode + command_count = 0 + +# output(pd, 1) +# output(ptt, 1) +# sleep(1) +# if (no_command == False and GPIO.input(squelch) == False): + if GPIO.input(squelch) == False: + print("carrier received!") + # command_tx = not command_tx +# print(command_tx) + + try: + file = open("/home/pi/CubeSatSim/command_count.txt", "r") + string = file.read() + file.close() + command_count = int(string) + command_count += 1 + filec = open("/home/pi/CubeSatSim/command_count.txt", "w") + command_count_string = str(command_count) + print(command_count_string) + string = filec.write(command_count_string) + filec.close() + except: + print("Can't write command_count file!") + print("Command_count: ") + print(command_count) + + increment_mode() + +# if (command_tx == True): +# print("Turning on transmit") +# system("echo > command_tx True") +# output(txLed, txLedOn) +# sleep(0.5) +# output(txLed, txLedff) +# else: +# print("Turning off transmit") +# system("echo > command_tx False") + else: + print("No carrier received!") +# output(pd, 0) +# sleep(1) + +def increment_mode(): + print("increment mode") + powerPin = 16 + try: + file = open("/home/pi/CubeSatSim/.mode") + mode = file.read(1) + except: +# 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'): + mode = 'f' + GPIO.output(powerPin, 0) # blink two times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + elif (mode == 'f'): + mode = 'b' + GPIO.output(powerPin, 0) # blink three times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + elif (mode == 'b'): + mode = 's' + GPIO.output(powerPin, 0) # blink four times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + elif (mode == 's'): + mode = 'm' + GPIO.output(powerPin, 0) # blink five times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1); + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + else: + mode = 'a' + GPIO.output(powerPin, 0) # blink one time + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(2.5) + + try: + file = open("/home/pi/CubeSatSim/.mode", "w") + count_string = str(command_count) + file.write(mode) + file.close() + print(".mode file written") + + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + print("sudo reboot -h now") + GPIO.setwarnings(False) + GPIO.setup(powerPin, GPIO.OUT) + GPIO.output(powerPin, 0); +# system("reboot -h now") +# release = True; + + print("Changing mode now") +# system("/home/pi/CubeSatSim/config -" + mode) + system("reboot -h now") + + sleep(10); + except: + print("can't write to .mode file") + +while True: + command_control_check() From a73d7721dc7293f9b44f5d8efbdb69f5634b458d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:37:48 -0400 Subject: [PATCH 003/125] Update squelch_cc.py fixed indents --- squelch_cc.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 4a28f8c8..8b474790 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -5,8 +5,8 @@ def command_control_check(): # global command_control # global no_command -# global debug_mode - command_count = 0 +# global debug_mode + command_count = 0 # output(pd, 1) # output(ptt, 1) @@ -17,21 +17,21 @@ def command_control_check(): # command_tx = not command_tx # print(command_tx) - try: - file = open("/home/pi/CubeSatSim/command_count.txt", "r") - string = file.read() - file.close() - command_count = int(string) - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) + try: + file = open("/home/pi/CubeSatSim/command_count.txt", "r") + string = file.read() + file.close() + command_count = int(string) + command_count += 1 + filec = open("/home/pi/CubeSatSim/command_count.txt", "w") + command_count_string = str(command_count) + print(command_count_string) + string = filec.write(command_count_string) + filec.close() + except: + print("Can't write command_count file!") + print("Command_count: ") + print(command_count) increment_mode() @@ -162,4 +162,4 @@ def increment_mode(): print("can't write to .mode file") while True: - command_control_check() + command_control_check() From c85a5c4ebf6defc727e924cb5fc02945527f5061 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:39:47 -0400 Subject: [PATCH 004/125] Update squelch_cc.py added squelch pin --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index 8b474790..c3a8ae2a 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -7,6 +7,7 @@ def command_control_check(): # global no_command # global debug_mode command_count = 0 + squelch = 6 # output(pd, 1) # output(ptt, 1) From 6896eaf02683f1e43cc24cb31b18ee9eafc5f2c5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:41:26 -0400 Subject: [PATCH 005/125] Update squelch_cc.py add gpio set mode --- squelch_cc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/squelch_cc.py b/squelch_cc.py index c3a8ae2a..0c766daf 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -161,6 +161,8 @@ def increment_mode(): sleep(10); except: print("can't write to .mode file") - + +GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) while True: command_control_check() From 12bf7a2ba1bfb8d742f7b4dec5c7fefcd46a4ed0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:44:24 -0400 Subject: [PATCH 006/125] Update squelch_cc.py set squelch pin mode --- squelch_cc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squelch_cc.py b/squelch_cc.py index 0c766daf..b5487e1c 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -164,5 +164,7 @@ def increment_mode(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) +GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected + while True: command_control_check() From 047ee2e215a6989723bd6780937c41ab8dd8be67 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:45:28 -0400 Subject: [PATCH 007/125] Update squelch_cc.py set squelch to 6 --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index b5487e1c..9df6735f 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -164,6 +164,7 @@ def increment_mode(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) +squelch = 6 GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected while True: From 19d21393b2d6035f406caa53f76c8b592d93d60c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:47:35 -0400 Subject: [PATCH 008/125] Update squelch_cc.py set powerPin mode --- squelch_cc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squelch_cc.py b/squelch_cc.py index 9df6735f..ebf7eac2 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -165,7 +165,9 @@ def increment_mode(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) squelch = 6 +powerPin = 16 GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected +GPIO.setup(powerPin, GPIO.OUT) while True: command_control_check() From 602aa71e2ecade9e9e3b1adb973a97c5bcdabdff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:48:38 -0400 Subject: [PATCH 009/125] Update squelch_cc.py fix sleep --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index ebf7eac2..306dca58 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -1,5 +1,6 @@ import RPi.GPIO as GPIO from RPi.GPIO import output +import time def command_control_check(): From 46a4bf4c883b028f002e9536c5fe28f0e5690ddc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:50:06 -0400 Subject: [PATCH 010/125] Update squelch_cc.py fix sleep --- squelch_cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squelch_cc.py b/squelch_cc.py index 306dca58..e15c5010 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -1,6 +1,6 @@ import RPi.GPIO as GPIO from RPi.GPIO import output -import time +from time import sleep def command_control_check(): From 3767408a56c2f442419f4e4e162e63441ac99d83 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:54:09 -0400 Subject: [PATCH 011/125] Update squelch_cc.py change to config script --- squelch_cc.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index e15c5010..5787f4e2 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -139,29 +139,32 @@ def increment_mode(): sleep(2.5) try: - file = open("/home/pi/CubeSatSim/.mode", "w") - count_string = str(command_count) - file.write(mode) - file.close() - print(".mode file written") + print("/home/pi/CubeSatSim/config -" + mode) + system("/home/pi/CubeSatSim/config -" + mode) - GPIO.setwarnings(False) - GPIO.output(txLed, 0) - GPIO.output(powerPin, 0) - print("sudo reboot -h now") - GPIO.setwarnings(False) - GPIO.setup(powerPin, GPIO.OUT) - GPIO.output(powerPin, 0); +# file = open("/home/pi/CubeSatSim/.mode", "w") +# count_string = str(command_count) +# file.write(mode) +# file.close() +# print(".mode file written") + +# GPIO.setwarnings(False) +# GPIO.output(txLed, 0) +# GPIO.output(powerPin, 0) +# print("sudo reboot -h now") +# GPIO.setwarnings(False) +# GPIO.setup(powerPin, GPIO.OUT) +# GPIO.output(powerPin, 0); # system("reboot -h now") # release = True; print("Changing mode now") # system("/home/pi/CubeSatSim/config -" + mode) - system("reboot -h now") +# system("reboot -h now") sleep(10); except: - print("can't write to .mode file") + print("can't change mode") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 908012ed779e0ec1a639c4a4c7873c19579e05a3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 12:57:08 -0400 Subject: [PATCH 012/125] Update squelch_cc.py remove debug mode --- squelch_cc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 5787f4e2..c8da9147 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -59,8 +59,8 @@ def increment_mode(): mode = file.read(1) except: # mode = "f" - if (debug_mode == 1): - print("Can't open .mode file") # , defaulting to FSK") +# if (debug_mode == 1): + print("Can't open .mode file") # , defaulting to FSK") file.close() print("Mode is: ") print(mode) From 6b52d10a54e1b9583139581ccbc3bd5154b32ce1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 13:01:08 -0400 Subject: [PATCH 013/125] Update squelch_cc.py import system --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index c8da9147..32a4a2b8 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -1,6 +1,7 @@ import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep +from os import system def command_control_check(): From 40c65cd5fc30b242f6aff93ee3b0a1da2c186bc0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 13:11:07 -0400 Subject: [PATCH 014/125] Update squelch_cc.py add sleep 0.5 --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index 32a4a2b8..2ba4c4c5 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -176,3 +176,4 @@ GPIO.setup(powerPin, GPIO.OUT) while True: command_control_check() + sleep(0.5) From 1f3cd708b36dc0f8cb2f870ada711e39b489869d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:40:23 -0400 Subject: [PATCH 015/125] Update squelch_cc.py add debug mode with d --- squelch_cc.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 2ba4c4c5..bb9e2240 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -7,7 +7,7 @@ def command_control_check(): # global command_control # global no_command -# global debug_mode + global debug_mode command_count = 0 squelch = 6 @@ -47,12 +47,14 @@ def command_control_check(): # else: # print("Turning off transmit") # system("echo > command_tx False") - else: - print("No carrier received!") +## else: +## print("No carrier received!") # output(pd, 0) # sleep(1) def increment_mode(): + global debug_mode + print("increment mode") powerPin = 16 try: @@ -141,7 +143,8 @@ def increment_mode(): try: print("/home/pi/CubeSatSim/config -" + mode) - system("/home/pi/CubeSatSim/config -" + mode) + if (debug_mode == False): + system("/home/pi/CubeSatSim/config -" + mode) # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) @@ -166,7 +169,13 @@ def increment_mode(): sleep(10); except: print("can't change mode") - + +debug_mode = False +if (len(sys.argv)) > 1: +# print("There are arguments!") + if ('d' == sys.argv[1]): + debug_mode = True + GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) squelch = 6 From a04f63bb2e707b141bb4879217603b7bfba34041 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:41:50 -0400 Subject: [PATCH 016/125] Update squelch_cc.py import sys --- squelch_cc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/squelch_cc.py b/squelch_cc.py index bb9e2240..2297c811 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -2,6 +2,7 @@ import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep from os import system +import sys def command_control_check(): From 580b15c9c134a01b5577e9b63f26e1463ee7dfc6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:47:03 -0400 Subject: [PATCH 017/125] Update squelch_cc.py add print --- squelch_cc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 2297c811..9d774817 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -163,19 +163,21 @@ def increment_mode(): # system("reboot -h now") # release = True; - print("Changing mode now") + print("Changing mode now") # system("/home/pi/CubeSatSim/config -" + mode) # system("reboot -h now") - - sleep(10); + print +# sleep(10); except: print("can't change mode") +print("Squelch Command and Control active") debug_mode = False if (len(sys.argv)) > 1: # print("There are arguments!") if ('d' == sys.argv[1]): debug_mode = True + print("Debug mode - mode changes not made") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) From 21b9bc8dc85c89e8605ed1dc5ef32467483e3988 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 14:48:23 -0400 Subject: [PATCH 018/125] Update rpitx.py don't do command and control check --- rpitx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpitx.py b/rpitx.py index ed5c0733..57d0391b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -17,6 +17,8 @@ def command_control_check(): global no_command global debug_mode global command_count + + return output(pd, 1) output(ptt, 1) From 15061986d953e4c7f6f1b022eaec2c320c294738 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:01:44 -0400 Subject: [PATCH 019/125] Update rpitx.py add sleep 0.5 between CW channels --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 57d0391b..b3018d52 100644 --- a/rpitx.py +++ b/rpitx.py @@ -526,7 +526,8 @@ if __name__ == "__main__": system("cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff) - command_control_check() + command_control_check() + sleep(0.5) f.close() sleep(5) except: From 26621eb84c87122a9a868b1e202158742b3b3778 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:12:37 -0400 Subject: [PATCH 020/125] Update squelch_cc.py turn off LEDs and tx --- squelch_cc.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 9d774817..18d2d09d 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -77,7 +77,7 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) elif (mode == 'f'): mode = 'b' @@ -92,7 +92,7 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) elif (mode == 'b'): mode = 's' @@ -111,7 +111,7 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) elif (mode == 's'): mode = 'm' @@ -134,13 +134,13 @@ def increment_mode(): GPIO.output(powerPin, 0) sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) else: mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) - sleep(2.5) + sleep(1) try: print("/home/pi/CubeSatSim/config -" + mode) @@ -153,9 +153,10 @@ def increment_mode(): # file.close() # print(".mode file written") -# GPIO.setwarnings(False) -# GPIO.output(txLed, 0) -# GPIO.output(powerPin, 0) + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") # print("sudo reboot -h now") # GPIO.setwarnings(False) # GPIO.setup(powerPin, GPIO.OUT) @@ -183,8 +184,10 @@ GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) squelch = 6 powerPin = 16 +txLed = 27 GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected GPIO.setup(powerPin, GPIO.OUT) +GPIO.setup(txLed, GPIO.OUT) while True: command_control_check() From e2a2ef8d37d78ed9b63265b9edc728a0d09c8dba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:15:00 -0400 Subject: [PATCH 021/125] Update squelch_cc.py fix txLED variable --- squelch_cc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squelch_cc.py b/squelch_cc.py index 18d2d09d..3461d2ae 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -10,7 +10,8 @@ def command_control_check(): # global no_command global debug_mode command_count = 0 - squelch = 6 + global squelch + global txLed # output(pd, 1) # output(ptt, 1) From 145b5b363b93395f6e628ae684c31b1a123d33fc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:20:22 -0400 Subject: [PATCH 022/125] Update squelch_cc.py turn off LEDs sooner --- squelch_cc.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index 3461d2ae..b6973e94 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -145,30 +145,27 @@ def increment_mode(): try: print("/home/pi/CubeSatSim/config -" + mode) - if (debug_mode == False): + if (debug_mode == False): + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") system("/home/pi/CubeSatSim/config -" + mode) - + print("Changing mode now") # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) # file.write(mode) # file.close() # print(".mode file written") - - GPIO.setwarnings(False) - GPIO.output(txLed, 0) - GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") # print("sudo reboot -h now") # GPIO.setwarnings(False) # GPIO.setup(powerPin, GPIO.OUT) # GPIO.output(powerPin, 0); # system("reboot -h now") # release = True; - - print("Changing mode now") # system("/home/pi/CubeSatSim/config -" + mode) # system("reboot -h now") - print + print(" ") # sleep(10); except: print("can't change mode") From f91318b661e7fac79b824ba43c3c80ce382505dc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:22:47 -0400 Subject: [PATCH 023/125] Update aprs_in.py add immediate LED and tx stop --- aprs_in.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aprs_in.py b/aprs_in.py index e696bb6d..a4860715 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -1,8 +1,11 @@ import sys from os import system +import RPi.GPIO as GPIO +from RPi.GPIO import output if __name__ == "__main__": - + powerPin = 16 + txLed = 27 change_mode = False debug_mode = False if (len(sys.argv)) > 1: @@ -38,6 +41,11 @@ if __name__ == "__main__": mode = 'm' change_mode = True if (debug_mode == False) and (change_mode == True): + GPIO.setmode(GPIO.BCM) + GPIO.setwarnings(False) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") try: file = open("/home/pi/CubeSatSim/command_count.txt", "r") string = file.read() From 024eae76f1f8e736b50f1d17ed0a0f49cf4d01e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:28:05 -0400 Subject: [PATCH 024/125] Update aprs_in.py fix gpio settings --- aprs_in.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index a4860715..846a309f 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -43,6 +43,8 @@ if __name__ == "__main__": if (debug_mode == False) and (change_mode == True): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) + GPIO.setup(powerPin, GPIO.OUT) + GPIO.setup(txLed, GPIO.OUT) GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") From 3e966603831221fd8973097131312dbba4e3a46d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:31:23 -0400 Subject: [PATCH 025/125] Update aprs_in.py add LED blinks --- aprs_in.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 846a309f..b5775f75 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -45,6 +45,76 @@ if __name__ == "__main__": GPIO.setwarnings(False) GPIO.setup(powerPin, GPIO.OUT) GPIO.setup(txLed, GPIO.OUT) + + if (mode == 'f'): + GPIO.output(powerPin, 0) # blink two times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 'b'): + GPIO.output(powerPin, 0) # blink three times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 's'): + GPIO.output(powerPin, 0) # blink four times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + + elif (mode == 'm'): + GPIO.output(powerPin, 0) # blink five times + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1); + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(0.1) + GPIO.output(powerPin, 0) + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + else: + GPIO.output(powerPin, 0) # blink one time + sleep(0.1) + GPIO.output(powerPin, 1) + sleep(1) + GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") From 5b7ebaf077976468d728fd0685a6ff6ea36d77e8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:32:36 -0400 Subject: [PATCH 026/125] Update aprs_in.py fix sleep --- aprs_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprs_in.py b/aprs_in.py index b5775f75..4dc3b0d5 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -2,6 +2,7 @@ import sys from os import system import RPi.GPIO as GPIO from RPi.GPIO import output +from time import sleep if __name__ == "__main__": powerPin = 16 From a6736af1cc1cce217fe0c753cddd21032d914de1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:44:01 -0400 Subject: [PATCH 027/125] Update command to check for USB sound card, exit if C&C off --- command | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/command b/command index b995446d..80c81525 100755 --- a/command +++ b/command @@ -5,28 +5,36 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" - echo "Turning Command and control to OFF" - sudo rm /home/pi/CubeSatSim/command_control - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now +# echo "Turning Command and control to OFF" +# sudo rm /home/pi/CubeSatSim/command_control +# echo "rebooting" +# sudo systemctl stop rpitx +# sudo reboot now # fi else echo "Radio command and control is OFF" + exit 1 fi -echo "Starting direwolf" -if [ "$1" = "d" ]; then +# if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then + if [[ $(arecord -l | grep card) ]]; then -echo "debug mode" - -direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d + echo "Starting direwolf" + if [ "$1" = "d" ]; then + + echo "debug mode" + + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d + + else + + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + + fi else - -direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + echo "Starting squelch C&C" fi - From ba0bea860c0bb0b330ec5b3c3db2dc6f0f406879 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 15:48:41 -0400 Subject: [PATCH 028/125] Update command add squelch python command --- command | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/command b/command index 80c81525..a79c617f 100755 --- a/command +++ b/command @@ -37,4 +37,15 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" else echo "Starting squelch C&C" + if [ "$1" = "d" ]; then + + echo "debug mode" + + python3 /home/pi/CubeSatSim/squelch_cc.py d + + else + + python3 /home/pi/CubeSatSim/squelch_cc.py + + fi fi From 9ca5a669af35a25780a274becf634c073096eaa6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:06:35 -0400 Subject: [PATCH 029/125] Update rpitx.py activate command script in background --- rpitx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rpitx.py b/rpitx.py index b3018d52..38d97c8c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -375,6 +375,7 @@ if __name__ == "__main__": else: print("command and control is activated") no_command = False + system("/home/pi/CubeSatSim/command &") except: print("command and control not activated") no_command = True From 3ee9217c821b0704606c1d1b4b332384bc509151 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:16:20 -0400 Subject: [PATCH 030/125] Update config added reboot to wall echo --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index fdb2f786..5f103d62 100755 --- a/config +++ b/config @@ -850,6 +850,7 @@ fi if [ "$reboot" = "1" ] ; then if [ "$noreboot" = "0" ] ; then + echo 'Reboot due to mode change!' | wall echo "Rebooting" sudo systemctl stop rpitx sudo reboot now From 30b23193efb31b9d4c7bbb62bdea970196418ed5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:31:22 -0400 Subject: [PATCH 031/125] Update rpitx.py to clog.txt --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 38d97c8c..a24c8fdc 100644 --- a/rpitx.py +++ b/rpitx.py @@ -375,7 +375,7 @@ if __name__ == "__main__": else: print("command and control is activated") no_command = False - system("/home/pi/CubeSatSim/command &") + system("/home/pi/CubeSatSim/command & > cclog.txt") except: print("command and control not activated") no_command = True From c7ba0ca01cff55431f2fdc79de13b7ac5dcf4ae8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:42:36 -0400 Subject: [PATCH 032/125] Update aprs_in.py set mode to a in else --- aprs_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprs_in.py b/aprs_in.py index 4dc3b0d5..585de872 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -111,6 +111,7 @@ if __name__ == "__main__": GPIO.output(powerPin, 1) sleep(1) else: + mode = 'a' GPIO.output(powerPin, 0) # blink one time sleep(0.1) GPIO.output(powerPin, 1) From 8005d1129dd37a604979ab515183e307a3fcadea Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:46:26 -0400 Subject: [PATCH 033/125] Update aprs_in.py move rpitx stop --- aprs_in.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index 585de872..db16c593 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -117,9 +117,6 @@ if __name__ == "__main__": GPIO.output(powerPin, 1) sleep(1) - GPIO.output(txLed, 0) - GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") try: file = open("/home/pi/CubeSatSim/command_count.txt", "r") string = file.read() @@ -138,5 +135,9 @@ if __name__ == "__main__": print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) + GPIO.output(txLed, 0) + GPIO.output(powerPin, 0) + system("sudo systemctl stop rpitx") + change_mode = False print("Done") From 4ce3dc5d54a8eca42d5af2f3cea0aeac073fc474 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:47:40 -0400 Subject: [PATCH 034/125] Update squelch_cc.py also move rpitx stop --- squelch_cc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index b6973e94..a0dc8604 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -147,11 +147,12 @@ def increment_mode(): print("/home/pi/CubeSatSim/config -" + mode) if (debug_mode == False): GPIO.setwarnings(False) + system("/home/pi/CubeSatSim/config -" + mode) + print("Changing mode now") GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") - system("/home/pi/CubeSatSim/config -" + mode) - print("Changing mode now") + # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) # file.write(mode) From 6fa3673cd5c3d8a55bf864b5b8b16f8bc069c96b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:48:39 -0400 Subject: [PATCH 035/125] Update rpitx.py remove cclog.txt since didn't work --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index a24c8fdc..38d97c8c 100644 --- a/rpitx.py +++ b/rpitx.py @@ -375,7 +375,7 @@ if __name__ == "__main__": else: print("command and control is activated") no_command = False - system("/home/pi/CubeSatSim/command & > cclog.txt") + system("/home/pi/CubeSatSim/command &") except: print("command and control not activated") no_command = True From b09d964641cd1d08bb3bc99e1eba59fab8ac360c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:53:47 -0400 Subject: [PATCH 036/125] Update rpitx.py don't activate command and control here --- rpitx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpitx.py b/rpitx.py index 38d97c8c..6fa3a32b 100644 --- a/rpitx.py +++ b/rpitx.py @@ -373,9 +373,9 @@ if __name__ == "__main__": print("squelch not set correctly, no command input!") no_command = True else: - print("command and control is activated") + print("NOT: command and control is activated") no_command = False - system("/home/pi/CubeSatSim/command &") +# system("/home/pi/CubeSatSim/command &") except: print("command and control not activated") no_command = True From 9270698d36c0807544f841d0383a098bebc3cb04 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:55:41 -0400 Subject: [PATCH 037/125] Update main.c start c&c here --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 1705a9bd..b835aac0 100644 --- a/main.c +++ b/main.c @@ -101,6 +101,9 @@ int main(int argc, char * argv[]) { // FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); + + FILE * cc_start = popen("python3 /home/pi/CubeSatSim/command &", "r"); + pclose(cc_stop); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); // pclose(file_deletes); From af32be02ce3fb6c91b52797d74de606c42c67e62 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 16:57:34 -0400 Subject: [PATCH 038/125] Update main.c typo cc_start --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index b835aac0..0e65ec4f 100644 --- a/main.c +++ b/main.c @@ -103,7 +103,7 @@ int main(int argc, char * argv[]) { pclose(rpitx_stop); FILE * cc_start = popen("python3 /home/pi/CubeSatSim/command &", "r"); - pclose(cc_stop); + pclose(cc_start); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); // pclose(file_deletes); From f831bf1a291b2548cc2b06e9a784aa406d39628b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:04:11 -0400 Subject: [PATCH 039/125] Update main.c typo in command command --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 0e65ec4f..6e65740e 100644 --- a/main.c +++ b/main.c @@ -102,7 +102,7 @@ int main(int argc, char * argv[]) { FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); - FILE * cc_start = popen("python3 /home/pi/CubeSatSim/command &", "r"); + FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); pclose(cc_start); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); From 808992cb5fbfe51cee02616bd644d9f8aae1860f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:49:00 -0400 Subject: [PATCH 040/125] Create command.service for c&c --- systemd/command.service | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 systemd/command.service diff --git a/systemd/command.service b/systemd/command.service new file mode 100644 index 00000000..3f19fa8a --- /dev/null +++ b/systemd/command.service @@ -0,0 +1,16 @@ +[Unit] +Description=Command service + +[Service] +TimeoutStopSec=5 +ExecStart=/home/pi/CubeSatSim/command +WorkingDirectory=/home/pi/CubeSatSim +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root +CPUAccounting=true +CPUQuota=5% + +[Install] +WantedBy=default.target From 9bb40c77a6444a471677a5c18262730e578b97fd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:50:32 -0400 Subject: [PATCH 041/125] Update main.c don't start command here --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 6e65740e..ce9e8c05 100644 --- a/main.c +++ b/main.c @@ -102,8 +102,8 @@ int main(int argc, char * argv[]) { FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r"); pclose(rpitx_stop); - FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); - pclose(cc_start); +// FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r"); +// pclose(cc_start); // FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r"); // pclose(file_deletes); From 84dad54f1e78e38a7eff6a20fbdc773e52d07de3 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 17:54:13 -0400 Subject: [PATCH 042/125] Update update added command.service and echo wall --- update | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/update b/update index d877a13e..77f14002 100755 --- a/update +++ b/update @@ -85,6 +85,14 @@ if [ ! -f "$FILE" ]; then echo "Copying SSTV image 2." cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg fi + +if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then + echo "changed rpitx.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 +else + echo "no changes to command.service." +fi grep 'update' /home/pi/CubeSatSim/.updated if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then @@ -278,7 +286,7 @@ if [ "$noreboot" = "0" ] ; then else grep 'changed' /home/pi/CubeSatSim/.updated if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then - echo "reboot" + echo "reboot due to code changes " | wall sudo reboot -h now # sudo systemctl restart cubesatsim else From 95b6a695a98a76e0217bb225fd5faba0136882ba Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:00:58 -0400 Subject: [PATCH 043/125] Update update create command.service if not present --- update | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/update b/update index 77f14002..7b81d0d1 100755 --- a/update +++ b/update @@ -74,6 +74,21 @@ else echo "no changes to rpitx.service." fi +FILE=/etc/systemd/system/command.service +if [ -f "$FILE" ]; then + if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then + echo "changed command.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 + else + echo "no change to command.service." + fi +else + echo "creating command.service." + sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + FLAG=1 +fi + FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg if [ ! -f "$FILE" ]; then echo "Copying SSTV image 1." @@ -85,14 +100,6 @@ if [ ! -f "$FILE" ]; then echo "Copying SSTV image 2." cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg fi - -if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then - echo "changed rpitx.service." - sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service - FLAG=1 -else - echo "no changes to command.service." -fi grep 'update' /home/pi/CubeSatSim/.updated if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then From ebd21e267d9978290c379c15b88c0ff4917c1b04 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:06:15 -0400 Subject: [PATCH 044/125] Update rpitx.py start command.service --- rpitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 6fa3a32b..d6f906af 100644 --- a/rpitx.py +++ b/rpitx.py @@ -373,9 +373,10 @@ if __name__ == "__main__": print("squelch not set correctly, no command input!") no_command = True else: - print("NOT: command and control is activated") + print("command and control is activated") no_command = False # system("/home/pi/CubeSatSim/command &") + system("sudo systemctl start command") except: print("command and control not activated") no_command = True From e5590666aa3c29c5793dc50bb78797fa8cf4dffa Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:08:49 -0400 Subject: [PATCH 045/125] Update aprs_in.py print all messages --- aprs_in.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index db16c593..9b5416c9 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -15,8 +15,8 @@ if __name__ == "__main__": debug_mode = True for line in sys.stdin: - if (debug_mode): - print(line, end =" ") +# if (debug_mode): + print(line, end =" ") # if '^c' == line.rstrip(): # break From 749e9b3b4d33bef789444355a93ade5f0cf040c0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:19:54 -0400 Subject: [PATCH 046/125] Update command.service increase cpu quota to 10% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 3f19fa8a..1c4e2bc3 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=10% [Install] WantedBy=default.target From 5ca157712a8263d166d0a2880800cf8b14f962b7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:25:54 -0400 Subject: [PATCH 047/125] Update command wait 20 seconds --- command | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command b/command index a79c617f..90b4942e 100755 --- a/command +++ b/command @@ -2,6 +2,8 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" +sleep 20 + FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" From c944be611333e9ef9e064c4bb4da8ce1c49a90b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:33:03 -0400 Subject: [PATCH 048/125] Update aprs_in.py stop rpitx and CubeSatSim before change mode --- aprs_in.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/aprs_in.py b/aprs_in.py index 9b5416c9..d341563c 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -131,13 +131,16 @@ if __name__ == "__main__": except: print("Can't write command_count file!") print("Command_count: ") - print(command_count) - - print("\n/home/pi/CubeSatSim/config -" + mode) - system("/home/pi/CubeSatSim/config -" + mode) + print(command_count) + GPIO.output(txLed, 0) GPIO.output(powerPin, 0) system("sudo systemctl stop rpitx") + system("sudo systemctl stop cubesatsim") + + print("\n/home/pi/CubeSatSim/config -" + mode) + system("/home/pi/CubeSatSim/config -" + mode) + change_mode = False print("Done") From 865e908b163119089abba24d9250c7fdcf010a46 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:34:52 -0400 Subject: [PATCH 049/125] Update squelch_cc.py stop rpitx and CubeSatSim before change mode --- squelch_cc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/squelch_cc.py b/squelch_cc.py index a0dc8604..9faa6ca8 100644 --- a/squelch_cc.py +++ b/squelch_cc.py @@ -147,11 +147,14 @@ def increment_mode(): print("/home/pi/CubeSatSim/config -" + mode) if (debug_mode == False): GPIO.setwarnings(False) - system("/home/pi/CubeSatSim/config -" + mode) - print("Changing mode now") GPIO.output(txLed, 0) GPIO.output(powerPin, 0) - system("sudo systemctl stop rpitx") + system("sudo systemctl stop rpitx") + system("sudo systemctl stop cubesatsim") + + system("/home/pi/CubeSatSim/config -" + mode) + print("Changing mode now") + # file = open("/home/pi/CubeSatSim/.mode", "w") # count_string = str(command_count) From 8c9fbf3ab0dee09956e082ac22b4369b9a675ef8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 18:39:39 -0400 Subject: [PATCH 050/125] Update aprs_in.py added sleep 5 at the end --- aprs_in.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index d341563c..33966cb0 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -143,4 +143,8 @@ if __name__ == "__main__": change_mode = False + + print("Waiting 5 seconds to allow unplug and plug of soundcard") + sleep(5) print("Done") + From c88492e74c816d32fc18a5aeed2e97f44d40c424 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:25:17 -0400 Subject: [PATCH 051/125] Update command.service reduce to 5% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 1c4e2bc3..3f19fa8a 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=10% +CPUQuota=5% [Install] WantedBy=default.target From 888e8425c2801c8d15cbf8bdcbd3c2326d343698 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:31:22 -0400 Subject: [PATCH 052/125] Update command.service 7% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 3f19fa8a..a68c3a7b 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=7% [Install] WantedBy=default.target From 56fd4e9398cdeff2037915faf1c1ab8ee7f9b6e9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:55:48 -0400 Subject: [PATCH 053/125] Update aprs_in.py added logging warning --- aprs_in.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 33966cb0..6f61b015 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -3,6 +3,8 @@ from os import system import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep +import logging +logging.warning('CC-Warning!') if __name__ == "__main__": powerPin = 16 From 0d74f6f68a297dad55ff72f6c07d2dc756fa961a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 11:57:09 -0400 Subject: [PATCH 054/125] Update command.service 8% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index a68c3a7b..e58a2678 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=7% +CPUQuota=8% [Install] WantedBy=default.target From 4bf4203bd5171817eabe05c5b179abf42e883d49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:13:10 -0400 Subject: [PATCH 055/125] Update command.service up to 10% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index e58a2678..1c4e2bc3 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=8% +CPUQuota=10% [Install] WantedBy=default.target From ce796dc6ce681cdd6a3ddc3830611bc98124f6b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:13:31 -0400 Subject: [PATCH 056/125] Update cubesatsim.service down to 3% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 11966c22..d8738632 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=3% [Install] WantedBy=default.target From 050dd4477bd9542a47503fbe19fd87f9fe413199 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:25:40 -0400 Subject: [PATCH 057/125] Update cubesatsim.service back to 5% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index d8738632..11966c22 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=3% +CPUQuota=5% [Install] WantedBy=default.target From f75ccfed3209226488b8ed25c2bd0e86dca396a2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 12:25:53 -0400 Subject: [PATCH 058/125] Update command.service up to 15% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 1c4e2bc3..c3201151 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=10% +CPUQuota=15% [Install] WantedBy=default.target From 0bd59be7d024575efb9ddc083d340afa9707c04e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:07:50 -0400 Subject: [PATCH 059/125] Update command.service remove CPU quota --- systemd/command.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/command.service b/systemd/command.service index c3201151..9354154f 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root -CPUAccounting=true -CPUQuota=15% [Install] WantedBy=default.target From 661f191e0057529b4044913722d157a14b6345f8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:28:01 -0400 Subject: [PATCH 060/125] Update cubesatsim.service reduced to 4 --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 11966c22..73436333 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=4% [Install] WantedBy=default.target From c6fe2867140d67a2a62c043e7e143d982cf83ab2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:28:28 -0400 Subject: [PATCH 061/125] Update command.service set quota to 11 --- systemd/command.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systemd/command.service b/systemd/command.service index 9354154f..9161a653 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,6 +9,8 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root +CPUAccounting=true +CPUQuota=11% [Install] WantedBy=default.target From fd5f4c86e9a1ed5dd96ba377eaa9b7b3fc50d040 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:39:43 -0400 Subject: [PATCH 062/125] Update main.c remove printfs --- main.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index ce9e8c05..db50337c 100644 --- a/main.c +++ b/main.c @@ -559,7 +559,7 @@ int main(int argc, char * argv[]) { uptime = (int) (uptime_sec + 0.5); // printf("Uptime sec: %f \n", uptime_sec); // #ifdef DEBUG_LOGGING - printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); +// printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime); // #endif fclose(uptime_file); @@ -572,7 +572,7 @@ int main(int argc, char * argv[]) { char * token; fputc('\n', file1); fgets(cmdbuffer, 1000, file1); - fprintf(stderr, "Python read Result: %s\n", cmdbuffer); +// fprintf(stderr, "Python read Result: %s\n", cmdbuffer); // serialPuts(uart_fd, cmdbuffer); // write INA data to Pico over serial @@ -614,22 +614,22 @@ int main(int argc, char * argv[]) { // if ((payload == ON) && (mode != BPSK)) { // moved to here // STEMBoardFailure = 0; payload = get_payload_serial(FALSE); - printf("get_payload_status: %d \n", payload); // not debug +// printf("get_payload_status: %d \n", payload); // not debug fflush(stdout); - printf("String: %s\n", buffer2); +// printf("String: %s\n", buffer2); fflush(stdout); strcpy(sensor_payload, buffer2); - printf(" Response from STEM Payload board: %s\n", sensor_payload); +// printf(" Response from STEM Payload board: %s\n", sensor_payload); telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a"); - printf("Writing payload string\n"); +// printf("Writing payload string\n"); time_t timeStamp; time(&timeStamp); // get timestamp // printf("Timestamp: %s\n", ctime(&timeStamp)); char timeStampNoNl[31], bat_string[31]; snprintf(timeStampNoNl, 30, "%.24s", ctime(&timeStamp)); - printf("TimeStamp: %s\n", timeStampNoNl); +// printf("TimeStamp: %s\n", timeStampNoNl); snprintf(bat_string, 30, "BAT %4.2f %5.1f", batteryVoltage, batteryCurrent); fprintf(telem_file, "%s %s %s\n", timeStampNoNl, bat_string, sensor_payload); // write telemetry string to telem.txt file fclose(telem_file); @@ -776,7 +776,7 @@ int main(int argc, char * argv[]) { } #ifdef DEBUG_LOGGING - fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); +// fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); #endif if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) @@ -822,7 +822,7 @@ int main(int argc, char * argv[]) { FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w"); if (fp != NULL) { - printf("Writing telem_string.txt\n"); +// printf("Writing telem_string.txt\n"); if (batteryVoltage != 4.5) fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent); else @@ -842,16 +842,16 @@ int main(int argc, char * argv[]) { if ((mode == AFSK) || (mode == CW)) { get_tlm(); sleep(25); - fprintf(stderr, "INFO: Sleeping for 25 sec\n"); +// fprintf(stderr, "INFO: Sleeping for 25 sec\n"); int rand_sleep = (int)rnd_float(0.0, 5.0); sleep(rand_sleep); - fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep); +// fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep); } else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK get_tlm_fox(); } else { // SSTV - fprintf(stderr, "Sleeping\n"); +// fprintf(stderr, "Sleeping\n"); sleep(50); } @@ -865,17 +865,17 @@ int main(int argc, char * argv[]) { #ifdef DEBUG_LOGGING // printf("Tx LED On 1\n"); #endif - printf("Sleeping to allow BPSK transmission to finish.\n"); +// printf("Sleeping to allow BPSK transmission to finish.\n"); sleep((unsigned int)(loop_count * 5)); - printf("Done sleeping\n"); + // printf("Done sleeping\n"); // digitalWrite(txLed, txLedOff); #ifdef DEBUG_LOGGING // printf("Tx LED Off\n"); #endif } else if (mode == FSK) { - printf("Sleeping to allow FSK transmission to finish.\n"); +// printf("Sleeping to allow FSK transmission to finish.\n"); sleep((unsigned int)loop_count); - printf("Done sleeping\n"); +// printf("Done sleeping\n"); } return 0; @@ -1192,7 +1192,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d\n", millis() - startSleep); +// printf("Sleep period: %d\n", millis() - startSleep); fflush(stdout); sampleTime = (unsigned int) millis(); @@ -1225,7 +1225,7 @@ void get_tlm_fox() { if (mode == FSK) { if (loop % 32 == 0) { // was 8 - printf("Sending MIN frame \n"); +// printf("Sending MIN frame \n"); frm_type = 0x03; for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) @@ -1239,7 +1239,7 @@ void get_tlm_fox() { } } if ((loop + 16) % 32 == 0) { // was 8 - printf("Sending MAX frame \n"); +// printf("Sending MAX frame \n"); frm_type = 0x02; for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) @@ -1483,7 +1483,7 @@ void get_tlm_fox() { } else printf("Error opening command_count.txt!\n"); - printf("Command count: %d\n", groundCommandCount); +// printf("Command count: %d\n", groundCommandCount); int status = STEMBoardFailure + SafeMode * 2 + sim_mode * 4 + PayloadFailure1 * 8 + (i2c_bus0 == OFF) * 16 + (i2c_bus1 == OFF) * 32 + (i2c_bus3 == OFF) * 64 + (camera == OFF) * 128 + groundCommandCount * 256; @@ -1769,7 +1769,7 @@ void get_tlm_fox() { { start = millis(); // send frame until buffer fills sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); - printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret); +// printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret); if ((millis() - start) > 500) { printf("Buffer over filled!\n"); From 80dbebc9cfeb205c466343d079bebca9d836f255 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:48:10 -0400 Subject: [PATCH 063/125] Update rpitx.py remove cc check for bps --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index d6f906af..f2a57e6a 100644 --- a/rpitx.py +++ b/rpitx.py @@ -757,7 +757,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - command_control_check() +# command_control_check() if (command_tx == True): output(txLed, txLedOn) From 0c9da136a306bac585e51807c2c9eede8ffc9835 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 1 Jul 2024 14:49:11 -0400 Subject: [PATCH 064/125] Update main.c removed last two prints --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index db50337c..88eed849 100644 --- a/main.c +++ b/main.c @@ -563,8 +563,8 @@ int main(int argc, char * argv[]) { // #endif fclose(uptime_file); - printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); - fflush(stdout); +// printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); +// fflush(stdout); loopTime = millis(); { @@ -1738,14 +1738,14 @@ void get_tlm_fox() { // printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start); start = millis(); int sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0); - printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret); +// printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret); fflush(stdout); if (sock_ret < (ctr * 2 + 2)) { // printf("Not resending\n"); sleep(0.5); sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0); - printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); +// printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret); } loop_count++; From a05b584769003fc62545033eeaca9d3f98f7902c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:04:57 -0400 Subject: [PATCH 065/125] Update config add c&c DTMF/APRS or carrier listing --- config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config b/config index 5f103d62..12394467 100755 --- a/config +++ b/config @@ -73,7 +73,11 @@ if [ "$1" = "" ]; then FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then - echo "Radio command and control is ON" + + if [[ $(arecord -l | grep card) ]]; then + echo "Radio DTMF/APRS command and control is ON" + else + echo "Radio carrier command and control is ON" else echo "Radio command and control is OFF" fi From 71fb2d21ae6477bbdae266f8248b4f9a90482859 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:06:40 -0400 Subject: [PATCH 066/125] Update log add -c for c&c log --- log | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/log b/log index 9518703d..3ce868f7 100755 --- a/log +++ b/log @@ -5,7 +5,11 @@ echo -e "\nLog file script for CubeSatSim\n" if [ "$1" = "-r" ]; then sudo journalctl -a -u rpitx > /home/pi/CubeSatSim/logr.txt cat /home/pi/CubeSatSim/logr.txt - echo -e "\nLog file also saved as /home/pi/CubeSatSim/logr.txt" + echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logr.txt" +elif [ "$1" = "-c" ]; then + sudo journalctl -a -u command > /home/pi/CubeSatSim/logc.txt + cat /home/pi/CubeSatSim/logc.txt + echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt" else sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt cat /home/pi/CubeSatSim/log.txt From a2abf2115bc6985acaea50ea83ed4f321cbf20e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:10:54 -0400 Subject: [PATCH 067/125] Update rpitx.py 10 seconds between SSTV and CW frames --- rpitx.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rpitx.py b/rpitx.py index f2a57e6a..280c58e5 100644 --- a/rpitx.py +++ b/rpitx.py @@ -529,11 +529,11 @@ if __name__ == "__main__": output(txLed, txLedOff) command_control_check() - sleep(0.5) + sleep(2) f.close() - sleep(5) + sleep(10) except: - command_control_check() +# command_control_check() sleep(1) elif (mode == 's'): print("SSTV") @@ -714,12 +714,12 @@ if __name__ == "__main__": output(txLed, txLedOff) # output (ptt, 1) # output(pd, 0) - sleep(5) + sleep(10) except: 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 " + tx + "e3 &") + system("(while true; do (sleep 10 && 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): command_control_check() @@ -741,7 +741,7 @@ if __name__ == "__main__": sleep(1) elif (mode == 'b'): - command_control_check() +# command_control_check() print("BPSK") print("turn on FM rx") output(pd, 1) @@ -777,7 +777,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - command_control_check() +# command_control_check() if (command_tx == True): output(txLed, txLedOn) sleep(4.2) From 7020ad16a5936f180e09b8b22756a6c4ab44b105 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 08:17:50 -0400 Subject: [PATCH 068/125] Update config missing fi --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 12394467..7eb5db72 100755 --- a/config +++ b/config @@ -78,6 +78,7 @@ if [ "$1" = "" ]; then echo "Radio DTMF/APRS command and control is ON" else echo "Radio carrier command and control is ON" + fi else echo "Radio command and control is OFF" fi From 0accaf48ea7ca9994fa1f23f4ab55ca9a0050383 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 11:37:12 -0400 Subject: [PATCH 069/125] Update config add command_control_direwolf --- config | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config b/config index 7eb5db72..40ac1e1a 100755 --- a/config +++ b/config @@ -75,13 +75,19 @@ if [ "$1" = "" ]; then if [ -f "$FILE" ]; then if [[ $(arecord -l | grep card) ]]; then - echo "Radio DTMF/APRS command and control is ON" + FILE=/home/pi/CubeSatSim/command_control_direwolf + if [ -f "$FILE" ]; then + echo "Radio DTMF/APRS command and control is ON" + else + echo "Radio carrier command and control is ON" + fi else echo "Radio carrier command and control is ON" fi else echo "Radio command and control is OFF" fi + echo echo -n "RX PL code is: " From 8b938a7ab86f20b70d06dcd9f97178d8f433b7e0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 11:44:50 -0400 Subject: [PATCH 070/125] Update command add test for command_control_direwolf --- command | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/command b/command index 90b4942e..a136a93f 100755 --- a/command +++ b/command @@ -19,9 +19,8 @@ sleep 20 exit 1 fi - -# if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then - if [[ $(arecord -l | grep card) ]]; then +FILE=/home/pi/CubeSatSim/command_control_direwolf +if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "Starting direwolf" From 85b8cc2f6aec8c01f5f4fe2e9ec6adebbf1e4b81 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 11:54:52 -0400 Subject: [PATCH 071/125] Update config add -d to turn Direwolf on and off --- config | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/config b/config index 40ac1e1a..6fb21e82 100755 --- a/config +++ b/config @@ -499,6 +499,49 @@ elif [ "$1" = "-T" ]; then fi +elif [ "$1" = "-d" ]; then + + echo + echo "Change command and control Direwolf state" + echo + + FILE=/home/pi/CubeSatSim/command_control_direwolf + if [ -f "$FILE" ]; then + echo "Radio command and control with Direwolf for DTMF and APRS is ON" + echo + echo "Do you want to turn Direwolf OFF and do Carrier command and control (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control Direwolf set to OFF" + sudo rm /home/pi/CubeSatSim/command_control_direwolf + reboot=1 +## echo "rebooting" +## sudo systemctl stop rpitx +## sudo reboot now + fi + + else + echo "Radio command and control with Direwolf for DTMF and APRS is OFF so carrier command and control is enabled" + echo + echo "Do you want to set command and control with Direwolf for DTMF and APRS to ON (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control Direwolf set to ON" + sudo touch /home/pi/CubeSatSim/command_control_direwolf +## echo "rebooting" + reboot=1 +## sudo systemctl stop rpitx +## sudo reboot now + fi + + fi + + + elif [ "$1" = "-R" ]; then echo From 13cbc124d96aff1db3c83175040e3689e1f0dba0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 12:00:02 -0400 Subject: [PATCH 072/125] Update config add -d to list and restart command not reboot --- config | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config b/config index 6fb21e82..a854b663 100755 --- a/config +++ b/config @@ -516,9 +516,9 @@ elif [ "$1" = "-d" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control Direwolf set to OFF" sudo rm /home/pi/CubeSatSim/command_control_direwolf - reboot=1 +# reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx + sudo systemctl restart command ## sudo reboot now fi @@ -533,8 +533,8 @@ elif [ "$1" = "-d" ]; then echo "Command and control Direwolf set to ON" sudo touch /home/pi/CubeSatSim/command_control_direwolf ## echo "rebooting" - reboot=1 -## sudo systemctl stop rpitx +# reboot=1 + sudo systemctl restart command ## sudo reboot now fi @@ -877,6 +877,7 @@ elif [ "$1" = "-h" ]; then echo " -S Scan both I2C buses on the Raspberry Pi" echo " -C Clear logs" echo " -T Change command and control state" + echo " -d Change command and control Direwolf state" echo " -R Change the Commands Count in the file command_count.txt" echo " -B Change Safe Mode (battery saver mode) manually" echo " -q Change the Squelch setting for command receiver" From 0ac105e87bdcf8b2c4e9ab4358f59c69fbf883d1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 20:54:20 -0400 Subject: [PATCH 073/125] Update config don't reboot on c&c on/off --- config | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config b/config index a854b663..5717e25f 100755 --- a/config +++ b/config @@ -475,9 +475,9 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to OFF" sudo rm /home/pi/CubeSatSim/command_control - reboot=1 -## echo "rebooting" -## sudo systemctl stop rpitx +# reboot=1 + echo "restarting command and control" + sudo systemctl restart command ## sudo reboot now fi @@ -491,9 +491,9 @@ elif [ "$1" = "-T" ]; then if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then echo "Command and control set to ON" sudo touch /home/pi/CubeSatSim/command_control -## echo "rebooting" - reboot=1 -## sudo systemctl stop rpitx + echo "restarting command and control" +# reboot=1 + sudo systemctl restart command ## sudo reboot now fi From cf3dfa0571fdd94616485272c610248247a20956 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 20:58:23 -0400 Subject: [PATCH 074/125] Update command only delay 20 sec for direwolf --- command | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/command b/command index a136a93f..da3eea85 100755 --- a/command +++ b/command @@ -2,8 +2,6 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" -sleep 20 - FILE=/home/pi/CubeSatSim/command_control if [ -f "$FILE" ]; then echo "Radio command and control is ON" @@ -22,7 +20,9 @@ sleep 20 FILE=/home/pi/CubeSatSim/command_control_direwolf if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then - echo "Starting direwolf" + echo "Starting direwolf after 20 second delay" + + sleep 20 if [ "$1" = "d" ]; then From 652747bfebe51ba80df01e530a73677d404cc501 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Jul 2024 21:12:55 -0400 Subject: [PATCH 075/125] Update command off while sleep loop --- command | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/command b/command index da3eea85..b4b999d8 100755 --- a/command +++ b/command @@ -14,7 +14,13 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" else echo "Radio command and control is OFF" - exit 1 + + while true + do + sleep 60 + done + +# exit 1 fi FILE=/home/pi/CubeSatSim/command_control_direwolf From d19593e48e70e2b6a75722c66d4acea49f09b472 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:11:32 -0400 Subject: [PATCH 076/125] Update install install command.service --- install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install b/install index 4e3fbeed..4b5f3aef 100755 --- a/install +++ b/install @@ -128,6 +128,10 @@ sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service sudo systemctl enable rpitx +sudo cp ~/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + +sudo systemctl enable command + sudo cp /boot/config.txt /boot/config.txt.0 sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 From 265476ff184b89494b3935089af142b458a62c27 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:15:10 -0400 Subject: [PATCH 077/125] Update update add enable command.service --- update | 1 + 1 file changed, 1 insertion(+) diff --git a/update b/update index 7b81d0d1..66f33928 100755 --- a/update +++ b/update @@ -86,6 +86,7 @@ if [ -f "$FILE" ]; then else echo "creating command.service." sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service + sudo systemctl enable command FLAG=1 fi From 22fff4df09f62439f6d4a9dc7223e72b6c188d94 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:25:22 -0400 Subject: [PATCH 078/125] Update config prompt to turn C&C on if off during direwolf change --- config | 55 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/config b/config index 5717e25f..ddd9a25e 100755 --- a/config +++ b/config @@ -122,7 +122,7 @@ elif [ "$1" = "-i" ]; then reboot=1 ## echo "Rebooting CubeSatSim" ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-a" ]; then echo "changing CubeSatSim to AFSK mode" @@ -139,9 +139,9 @@ elif [ "$1" = "-a" ]; then reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-m" ]; then @@ -158,9 +158,9 @@ elif [ "$1" = "-m" ]; then fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-f" ]; then echo "changing CubeSatSim to FSK mode" @@ -168,9 +168,9 @@ elif [ "$1" = "-f" ]; then # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-b" ]; then echo "changing CubeSatSim to BPSK mode" @@ -178,9 +178,9 @@ elif [ "$1" = "-b" ]; then # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-s" ]; then echo "changing CubeSatSim to SSTV mode" @@ -196,9 +196,9 @@ elif [ "$1" = "-s" ]; then fi reboot=1 ## echo "rebooting" -## sudo systemctl stop rpitx +## sudo stop rpitx ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim ## exit elif [ "$1" = "-t" ]; then @@ -245,7 +245,7 @@ elif [ "$1" = "-t" ]; then reboot=1 ## sudo reboot now -# sudo systemctl restart cubesatsim +# sudo restart cubesatsim elif [ "$1" = "-c" ]; then @@ -447,6 +447,7 @@ elif [ "$1" = "-C" ]; then sudo systemctl stop cubesatsim sudo systemctl stop rpitx + sudo systemctl stop command sudo mv -f /home/pi/CubeSatSim/telem.txt /home/pi/CubeSatSim/telem.txt.bk @@ -540,6 +541,28 @@ elif [ "$1" = "-d" ]; then fi + FILE=/home/pi/CubeSatSim/command_control + if [ -f "$FILE" ]; then + echo + + else + echo "Radio command and control is OFF" + echo + echo "Do you want to set command and control to ON (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control set to ON" + sudo touch /home/pi/CubeSatSim/command_control + echo "restarting command and control" +# reboot=1 + sudo systemctl restart command +## sudo reboot now + fi + + fi + elif [ "$1" = "-R" ]; then @@ -869,7 +892,7 @@ elif [ "$1" = "-h" ]; then echo " -f Change to FSK/DUV mode" echo " -b Change to BPSK mode" echo " -s Change to SSTV mode" - echo " -i Reboots CubeSatsim software" + echo " -i Restart CubeSatsim software" echo " -c Change the CALLSIGN in the configuration file sim.cfg" echo " -t Change the Simulated Telemetry setting in sim.cfg" echo " -r Change the Resets Count in the configuration file sim.cfg" @@ -881,8 +904,8 @@ elif [ "$1" = "-h" ]; then echo " -R Change the Commands Count in the file command_count.txt" echo " -B Change Safe Mode (battery saver mode) manually" echo " -q Change the Squelch setting for command receiver" - echo " -F Change the rx and tx frequency" - echo " -H Chnage the Balloon mode" + echo " -F Change the RX and TX frequency" + echo " -H Change the Balloon (HAB) mode" echo " -p Display payload sensor data" echo " -v Display voltage and current data" echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX" @@ -905,7 +928,7 @@ fi if [ "$reboot" = "1" ] ; then if [ "$noreboot" = "0" ] ; then - echo 'Reboot due to mode change!' | wall + echo 'Reboot due to config change!' | wall echo "Rebooting" sudo systemctl stop rpitx sudo reboot now From 12c765804c8673fe6913b070fad0b1cc43530551 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:30:19 -0400 Subject: [PATCH 079/125] Update aprs_in.py add logging.waring of each line --- aprs_in.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprs_in.py b/aprs_in.py index 6f61b015..6363db0e 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -19,6 +19,7 @@ if __name__ == "__main__": for line in sys.stdin: # if (debug_mode): print(line, end =" ") + logging.warning(line) # if '^c' == line.rstrip(): # break From 376502fdfb4e3bb01055386c7a2d01c614d31821 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:36:56 -0400 Subject: [PATCH 080/125] Update command move 20 sec --- command | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/command b/command index b4b999d8..b026f648 100755 --- a/command +++ b/command @@ -23,12 +23,14 @@ echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n" # exit 1 fi +echo "Waiting 20 seconds for USB" + +sleep 20 + FILE=/home/pi/CubeSatSim/command_control_direwolf if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then - echo "Starting direwolf after 20 second delay" - - sleep 20 + echo "Starting Direwolf DTMF and APRS Command and Control" if [ "$1" = "d" ]; then @@ -42,7 +44,7 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then fi else - echo "Starting squelch C&C" + echo "Starting Carrier (squelch) Command and Control" if [ "$1" = "d" ]; then From 381399fffd7a3b1e7d6f4f6f7f4662ab29b5ae8d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:43:21 -0400 Subject: [PATCH 081/125] Update and rename aprs_in.py to dtmf_aprs_cc.py and fix log --- aprs_in.py => dtmf_aprs_cc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename aprs_in.py => dtmf_aprs_cc.py (98%) diff --git a/aprs_in.py b/dtmf_aprs_cc.py similarity index 98% rename from aprs_in.py rename to dtmf_aprs_cc.py index 6363db0e..1da9797b 100644 --- a/aprs_in.py +++ b/dtmf_aprs_cc.py @@ -4,7 +4,8 @@ import RPi.GPIO as GPIO from RPi.GPIO import output from time import sleep import logging -logging.warning('CC-Warning!') +logging.basicConfig(format='%(message)s') +# logging.warning('CC-Warning!') if __name__ == "__main__": powerPin = 16 From 45c68a3619c9eeedb9de52aa18231af417f530b8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:44:24 -0400 Subject: [PATCH 082/125] Update command changed to dtmf_aprs_cc filename --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index b026f648..9d96cb24 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/aprs_in.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From e224c01bc91712c29323a4b09812732e05d45ae0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 10:58:33 -0400 Subject: [PATCH 083/125] Update main.c added echo broadcast to wall for shutdown and reboots --- main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 75e9bb2f..b16d0cf8 100644 --- a/main.c +++ b/main.c @@ -800,7 +800,11 @@ int main(int argc, char * argv[]) { fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); digitalWrite(txLed, txLedOff); digitalWrite(onLed, onLedOff); - + + FILE * file6; + file6 = popen("echo 'shutdown due to low battery voltage!' | wall", "r"); + pclose(file6); + sleep(1); digitalWrite(onLed, onLedOn); sleep(1); @@ -810,7 +814,6 @@ int main(int argc, char * argv[]) { sleep(1); digitalWrite(onLed, onLedOff); - FILE * file6; // = popen("/home/pi/CubeSatSim/log > shutdown_log.txt", "r"); file6 = popen("sudo shutdown -h now > /dev/null 2>&1", "r"); pclose(file6); sleep(10); @@ -2140,6 +2143,8 @@ if (setting == ON) { fprintf(stderr,"Turning Safe Mode ON\n"); fprintf(stderr,"Turning Battery saver mode ON\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { + command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); + pclose(command) command = popen("sudo reboot now", "r"); pclose(command); sleep(60); @@ -2154,6 +2159,8 @@ if (setting == ON) { pclose(command); fprintf(stderr,"Turning Battery saver mode OFF\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { + command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); + pclose(command) command = popen("sudo reboot now", "r"); pclose(command); sleep(60); From 914ca2b9b08ab0c992a431bfa631b16a19bf8fa6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 11:04:56 -0400 Subject: [PATCH 084/125] Update main.c missing ; --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index e7879034..5b3b85c5 100644 --- a/main.c +++ b/main.c @@ -2147,7 +2147,7 @@ if (setting == ON) { fprintf(stderr,"Turning Battery saver mode ON\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); - pclose(command) + pclose(command); command = popen("sudo reboot now", "r"); pclose(command); sleep(60); @@ -2163,7 +2163,7 @@ if (setting == ON) { fprintf(stderr,"Turning Battery saver mode OFF\n"); if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); - pclose(command) + pclose(command); command = popen("sudo reboot now", "r"); pclose(command); sleep(60); From b6a82762608d290bc0b51d887b411253eb4f9aad Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 11:29:11 -0400 Subject: [PATCH 085/125] Update config added -Q --- config | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config b/config index ddd9a25e..baba560e 100755 --- a/config +++ b/config @@ -690,6 +690,14 @@ elif [ "$1" = "-q" ]; then ## sudo reboot now # sudo systemctl restart cubesatsim +elif [ "$1" = "-Q" ]; then + + echo + echo "Reading current Squelch for 10 seconds" + echo "Squelch is active low (0 means squelch broken)" + echo + + timeout 10 bash -c -- 'while true; do (gpio read 22 && sleep 1); done' elif [ "$1" = "-P" ]; then From f9cb1e1a870d879ce9e8283d501f66ae07e08745 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 11:30:36 -0400 Subject: [PATCH 086/125] Update config removed blank line --- config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config b/config index baba560e..62149c36 100755 --- a/config +++ b/config @@ -131,7 +131,7 @@ elif [ "$1" = "-a" ]; then FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Safe Mode! Battery saver mode is ON." -# if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi +# if ! grep force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt @@ -692,7 +692,7 @@ elif [ "$1" = "-q" ]; then elif [ "$1" = "-Q" ]; then - echo +# echo echo "Reading current Squelch for 10 seconds" echo "Squelch is active low (0 means squelch broken)" echo From 953cb4a7376c1a666f062bfe3142fff19df3012a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 13:44:20 -0400 Subject: [PATCH 087/125] Update command if direwolf mode but no soundcard, print --- command | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/command b/command index 9d96cb24..1f72333c 100755 --- a/command +++ b/command @@ -44,7 +44,17 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then fi else - echo "Starting Carrier (squelch) Command and Control" + + if [ -f "$FILE" ]; then + + echo "Direwolf mode set but no USB soundcard detected!" + echo "Instead, starting Carrier (squelch) Command and Control" + + else + + echo "Starting Carrier (squelch) Command and Control" + + fi if [ "$1" = "d" ]; then From 382dcce298f6b249a26e5374f9f1d761258ba2d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:08:57 -0400 Subject: [PATCH 088/125] Update install missing python --- install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install b/install index 4b5f3aef..9881f5f6 100755 --- a/install +++ b/install @@ -47,13 +47,11 @@ sudo dpkg -i wiringpi-latest.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 sudo pip3 install --upgrade setuptools -sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 - - +sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow cd ~/CubeSatSim From f1de675a3b797b8142003e7b0dd0d9f7f4df7882 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:16:36 -0400 Subject: [PATCH 089/125] Update update changed to python3-pil --- update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update b/update index 66f33928..8dc2c0c6 100755 --- a/update +++ b/update @@ -219,8 +219,8 @@ git pull --no-rebase > .updated_p script/install sudo apt-get update && sudo apt-get dist-upgrade -y - sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 -y - sudo pip3 install pillow + sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil +# sudo pip3 install pillow fi From 6f153062dcb9110fce1ed1230df1b99b0e24814f Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:19:27 -0400 Subject: [PATCH 090/125] Update install python3-serial --- install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 9881f5f6..96b0c694 100755 --- a/install +++ b/install @@ -47,11 +47,11 @@ sudo dpkg -i wiringpi-latest.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil python3-serial sudo pip3 install --upgrade setuptools -sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow +sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 cd ~/CubeSatSim From 8870177db7ba263f08cff462a1fff6c38cd5389c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:21:54 -0400 Subject: [PATCH 091/125] Update rpitx.py move ser.close() --- rpitx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpitx.py b/rpitx.py index 280c58e5..b50d34e3 100644 --- a/rpitx.py +++ b/rpitx.py @@ -398,9 +398,9 @@ if __name__ == "__main__": # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") ser.write(uhf_string.encode()) sleep(0.1) + ser.close() except: print("Error in serial write") - ser.close() output(pd, 0) sleep(10) # delay so cubesatsim code catches up From 970e39780c050aa48fb1a9701217cf3276b1aacf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Wed, 3 Jul 2024 20:27:53 -0400 Subject: [PATCH 092/125] Update update changed to /boot/firmware --- update | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/update b/update index 8dc2c0c6..7929d66f 100755 --- a/update +++ b/update @@ -32,7 +32,7 @@ sudo sed -i 's/more information/more\ninformation/g' /etc/motd sudo sed -i 's/update to/update\nto/g' /etc/motd -sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2 +sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2 cd /home/pi/CubeSatSim @@ -190,27 +190,27 @@ git pull --no-rebase > .updated_p echo "nothing to do for pi-power-button." fi - if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then - echo "dtparam=audio=on already in /boot/config.txt" + if [[ $(grep 'dtparam=audio=on' /boot/firmware/config.txt) ]]; then + echo "dtparam=audio=on already in /boot/firmware/config.txt" else - echo "adding dtparam=audio=on to /boot/config.txt" - sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt' + echo "adding dtparam=audio=on to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/firmware/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then - echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt" + if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/firmware/config.txt) ]]; then + echo "dtoverlay=audremap,enable_jack=on already in /boot/firmware/config.txt" else - echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt' + echo "adding dtoverlay=audremap,enable_jack=on to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/firmware/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then - echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt" + if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/firmware/config.txt) ]]; then + echo "dtoverlay=pwm,pin=18,func=2 already in /boot/firmware/config.txt" else - echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/config.txt" - sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' + echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/firmware/config.txt' FLAG=1 cd /home/pi/pi-power-button @@ -224,24 +224,24 @@ git pull --no-rebase > .updated_p fi - if [[ $(grep 'disable_splash=1' /boot/config.txt) ]]; then - echo "disable_splash=1 already in /boot/config.txt" + if [[ $(grep 'disable_splash=1' /boot/firmware/config.txt) ]]; then + echo "disable_splash=1 already in /boot/firmware/config.txt" else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt' + echo "adding to /boot/firmware/config.txt" + sudo sh -c 'echo "\ndisable_splash=1" >> /boot/firmware/config.txt' FLAG=1 fi - if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then - echo "boot_delay=0 already in /boot/config.txt" + if [[ $(grep 'boot_delay=0' /boot/firmware/config.txt) ]]; then + echo "boot_delay=0 already in /boot/firmware/config.txt" else - echo "adding to /boot/config.txt" - sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt' + echo "adding to /boot/firmware/config.txt" + sudo sh -c 'echo "\nboot_delay=0" >> /boot/firmware/config.txt' FLAG=1 fi - if ! grep -q force_turbo=1 /boot/config.txt ; then - sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt' + if ! grep -q force_turbo=1 /boot/firmware/config.txt ; then + sudo sh -c 'echo "force_turbo=1" >> /boot/firmware/config.txt' FLAG=1 fi From deb73b8c2066e62bef9e2889683a6ff2cb9df3e4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:05:11 -0400 Subject: [PATCH 093/125] Update command dire wolf downsample -D 2 for lower cpu usage --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index 1f72333c..1c43ef12 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From ab53821e812f0fd52808bf9c6c5c3f67ff3f1cc5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:19:48 -0400 Subject: [PATCH 094/125] Update command.service changed to 15% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index 9161a653..c3201151 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=11% +CPUQuota=15% [Install] WantedBy=default.target From f4ae72901d20e2578916fb8824d4b747f0614097 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:31:43 -0400 Subject: [PATCH 095/125] Update command.service remove cpu quota from command --- systemd/command.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/command.service b/systemd/command.service index c3201151..9354154f 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root -CPUAccounting=true -CPUQuota=15% [Install] WantedBy=default.target From 9acae20e0d0871e3fae89a6497fbb877e157f6b9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:36:56 -0400 Subject: [PATCH 096/125] Update command dire wolf -D 3 --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index 1c43ef12..df2eee41 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 2 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From bcb4476b6474de74433be3eb55087fd5c63550b6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:38:52 -0400 Subject: [PATCH 097/125] Update update remove /firmware --- update | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/update b/update index 7929d66f..8dc2c0c6 100755 --- a/update +++ b/update @@ -32,7 +32,7 @@ sudo sed -i 's/more information/more\ninformation/g' /etc/motd sudo sed -i 's/update to/update\nto/g' /etc/motd -sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2 +sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2 cd /home/pi/CubeSatSim @@ -190,27 +190,27 @@ git pull --no-rebase > .updated_p echo "nothing to do for pi-power-button." fi - if [[ $(grep 'dtparam=audio=on' /boot/firmware/config.txt) ]]; then - echo "dtparam=audio=on already in /boot/firmware/config.txt" + if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then + echo "dtparam=audio=on already in /boot/config.txt" else - echo "adding dtparam=audio=on to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/firmware/config.txt' + echo "adding dtparam=audio=on to /boot/config.txt" + sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/firmware/config.txt) ]]; then - echo "dtoverlay=audremap,enable_jack=on already in /boot/firmware/config.txt" + if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then + echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt" else - echo "adding dtoverlay=audremap,enable_jack=on to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/firmware/config.txt' + echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt' FLAG=1 fi - if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/firmware/config.txt) ]]; then - echo "dtoverlay=pwm,pin=18,func=2 already in /boot/firmware/config.txt" + if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then + echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt" else - echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/firmware/config.txt' + echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/config.txt" + sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt' FLAG=1 cd /home/pi/pi-power-button @@ -224,24 +224,24 @@ git pull --no-rebase > .updated_p fi - if [[ $(grep 'disable_splash=1' /boot/firmware/config.txt) ]]; then - echo "disable_splash=1 already in /boot/firmware/config.txt" + if [[ $(grep 'disable_splash=1' /boot/config.txt) ]]; then + echo "disable_splash=1 already in /boot/config.txt" else - echo "adding to /boot/firmware/config.txt" - sudo sh -c 'echo "\ndisable_splash=1" >> /boot/firmware/config.txt' + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt' FLAG=1 fi - if [[ $(grep 'boot_delay=0' /boot/firmware/config.txt) ]]; then - echo "boot_delay=0 already in /boot/firmware/config.txt" + if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then + echo "boot_delay=0 already in /boot/config.txt" else - echo "adding to /boot/firmware/config.txt" - sudo sh -c 'echo "\nboot_delay=0" >> /boot/firmware/config.txt' + echo "adding to /boot/config.txt" + sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt' FLAG=1 fi - if ! grep -q force_turbo=1 /boot/firmware/config.txt ; then - sudo sh -c 'echo "force_turbo=1" >> /boot/firmware/config.txt' + if ! grep -q force_turbo=1 /boot/config.txt ; then + sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt' FLAG=1 fi From 1026c5d82d60b70d6bada88cd4ac438439df4f3e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:42:25 -0400 Subject: [PATCH 098/125] Update update add power button -cc branch --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index 8dc2c0c6..e2801b57 100755 --- a/update +++ b/update @@ -159,7 +159,7 @@ fi cd /home/pi/pi-power-button -# git checkout reboot-mode-change +git checkout reboot-mode-change-cc git pull --no-rebase > .updated_p From 3da4ec5b97d9d186d1f623d5a4f607aa1c062107 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 10:58:21 -0400 Subject: [PATCH 099/125] Update command.service adding back 9% --- systemd/command.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systemd/command.service b/systemd/command.service index 9354154f..f9b9ead2 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,6 +9,8 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root +CPUAccounting=true +CPUQuota=9% [Install] WantedBy=default.target From e93bb1fa583df6c883a965efcc831b98bcdddf9e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 11:04:07 -0400 Subject: [PATCH 100/125] Update command try -D 4 --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index df2eee41..f9a7998e 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 3 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From 4454818fb5b749e9aa97a002e2873293d37625d9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 11:07:23 -0400 Subject: [PATCH 101/125] Update command.service 10% --- systemd/command.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/command.service b/systemd/command.service index f9b9ead2..1c4e2bc3 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=9% +CPUQuota=10% [Install] WantedBy=default.target From ce0b71bd50f2574e4b7e65aebbf80aa626726576 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 11:10:54 -0400 Subject: [PATCH 102/125] Update command.service remove cpu quota --- systemd/command.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/systemd/command.service b/systemd/command.service index 1c4e2bc3..9354154f 100644 --- a/systemd/command.service +++ b/systemd/command.service @@ -9,8 +9,6 @@ StandardOutput=inherit StandardError=inherit Restart=always User=root -CPUAccounting=true -CPUQuota=10% [Install] WantedBy=default.target From 91b780e11250bae693a02a786fde101c9a120814 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 13:19:46 -0400 Subject: [PATCH 103/125] Update cubesatsim.service back to 5% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 73436333..11966c22 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=4% +CPUQuota=5% [Install] WantedBy=default.target From f30dcd3c7dd2d8003a05743416dfeac370bb24f1 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 13:22:11 -0400 Subject: [PATCH 104/125] Update main.c print loop time, no gps --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 5b3b85c5..2332d47f 100644 --- a/main.c +++ b/main.c @@ -563,8 +563,8 @@ int main(int argc, char * argv[]) { // #endif fclose(uptime_file); -// printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); -// fflush(stdout); + printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0); + fflush(stdout); loopTime = millis(); { @@ -675,8 +675,8 @@ int main(int argc, char * argv[]) { if ((millis() - newGpsTime) > 60000) { longitude += rnd_float(-0.05, 0.05) / 100.0; // was .05 latitude += rnd_float(-0.05, 0.05) / 100.0; - printf("GPS Location with Rnd: %f, %f \n", latitude, longitude); - printf("GPS Location with Rnd: APRS %07.2f, %08.2f \n", toAprsFormat(latitude), toAprsFormat(longitude)); +// printf("GPS Location with Rnd: %f, %f \n", latitude, longitude); +// printf("GPS Location with Rnd: APRS %07.2f, %08.2f \n", toAprsFormat(latitude), toAprsFormat(longitude)); newGpsTime = millis(); } From c23c116d6fae1071505725d4918b4544814592d6 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 13:34:47 -0400 Subject: [PATCH 105/125] Update main.c change sleep from -250 to -750 to reduce from 5.6 --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 2332d47f..3a716960 100644 --- a/main.c +++ b/main.c @@ -1188,10 +1188,10 @@ void get_tlm_fox() { /**/ // while ((millis() - sampleTime) < (unsigned int)samplePeriod) int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 250)) // was 250 100 500 for FSK + if ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 250)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ From 40b0343ccfa03c287a3c1d84c383257167d9398b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 14:27:22 -0400 Subject: [PATCH 106/125] Update main.c add pi_zero_2_offset --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 3a716960..7cf3f1e5 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,6 @@ 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'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 @@ -41,6 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); + pi_zero_2_offset = 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); @@ -646,7 +646,7 @@ int main(int argc, char * argv[]) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING - printf("sensor: %f ", sensor[count1]); // print sensor data +// printf("sensor: %f ", sensor[count1]); // print sensor data // #endif token = strtok(NULL, space); } @@ -1188,10 +1188,10 @@ void get_tlm_fox() { /**/ // while ((millis() - sampleTime) < (unsigned int)samplePeriod) int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 500 for FSK + if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 750)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offse)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ @@ -1980,7 +1980,7 @@ int get_payload_serial(int debug_camera) { if (serialDataAvail(uart_fd)) { char octet = (char) serialGetchar(uart_fd); - printf("%c", octet); +// printf("%c", octet); fflush(stdout); if (start_flag_complete) { @@ -1996,7 +1996,7 @@ int get_payload_serial(int debug_camera) { if (flag_count >= strlen(end_flag)) { // complete image index1 -= strlen(end_flag); buffer2[index1++] = 0; - printf(" Payload length: %d \n",index1); +// printf(" Payload length: %d \n",index1); // write_jpg(); finished = TRUE; From b2f36403ab1e349597106f87df0b0b131e9deb85 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 14:28:05 -0400 Subject: [PATCH 107/125] Update main.h add pi_zero_2_offset --- main.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.h b/main.h index 136718cb..92c2e3f4 100644 --- a/main.h +++ b/main.h @@ -187,7 +187,9 @@ int jpeg_start = 0; #define CAMERA_TIMEOUT 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); -int battery_saver_check(); +int battery_saver_check(); +int pi_zero_2_offset = 0; + int hab_mode = FALSE; int battery_saver_mode = FALSE; From 428432551611cb50de25d047afedd551591dc214 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 16:46:05 -0400 Subject: [PATCH 108/125] Update main.c typo missing t --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 7cf3f1e5..a75104ea 100644 --- a/main.c +++ b/main.c @@ -1191,7 +1191,7 @@ void get_tlm_fox() { if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offse)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ From e9837610ebd1b90d0cb5dc1102d3141fa7d17f5b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 16:49:19 -0400 Subject: [PATCH 109/125] Update main.c change pi zero 2 offset to 700 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index a75104ea..2c103d2f 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 500; + pi_zero_2_offset = 700; // 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From c16dc95d7b31193d352199d5843c4daada43d616 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 16:55:56 -0400 Subject: [PATCH 110/125] Update main.c print sleep period --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 2c103d2f..e7bda1ce 100644 --- a/main.c +++ b/main.c @@ -1195,7 +1195,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ -// printf("Sleep period: %d\n", millis() - startSleep); + printf("Sleep period: %d\n", millis() - startSleep); fflush(stdout); sampleTime = (unsigned int) millis(); From be1cd81fff16abd97b88783e3a4263e8ddfe0035 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 17:00:43 -0400 Subject: [PATCH 111/125] Update main.c print time for sleep --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index e7bda1ce..858f6c87 100644 --- a/main.c +++ b/main.c @@ -1195,7 +1195,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d\n", millis() - startSleep); + printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 - pi_zero_2_offset); fflush(stdout); sampleTime = (unsigned int) millis(); From cc62c7bae36474f0a3dcb0261cd0f89a290adc90 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:38:00 -0400 Subject: [PATCH 112/125] Update update add pip3 installs --- update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update b/update index e2801b57..bd1c4fee 100755 --- a/update +++ b/update @@ -220,7 +220,7 @@ git pull --no-rebase > .updated_p sudo apt-get update && sudo apt-get dist-upgrade -y sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil -# sudo pip3 install pillow + sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow fi From 7359ece7b4fa83a16d02ae32126c7729c03cb90a Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:41:34 -0400 Subject: [PATCH 113/125] Update install fixed python installs --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 96b0c694..6b2243f2 100755 --- a/install +++ b/install @@ -47,7 +47,7 @@ sudo dpkg -i wiringpi-latest.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil python3-serial +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial sudo pip3 install --upgrade setuptools From fab375e7515c651f8650e63072925a95fd380880 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:54:59 -0400 Subject: [PATCH 114/125] Update main.c fixed pi 2 offset --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 858f6c87..43dbc271 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 700; // 500; + _2_offset = 700; // 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); @@ -1188,14 +1188,14 @@ void get_tlm_fox() { /**/ // while ((millis() - sampleTime) < (unsigned int)samplePeriod) int startSleep = millis(); - if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 500 for FSK + if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) // was 250 100 500 for FSK // sleep(2.0); // 0.5); // 25); // initial period sleep(1.0); // 0.5); // 25); // initial period - while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 - pi_zero_2_offset)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) // was 250 100 sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 - pi_zero_2_offset); + printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset); fflush(stdout); sampleTime = (unsigned int) millis(); From 0c1babcec5e075ca28767cb356621d72fa7693dd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 4 Jul 2024 21:56:08 -0400 Subject: [PATCH 115/125] Update main.c typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 43dbc271..b64a4e59 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - _2_offset = 700; // 500; + pi_zero_2_offset = 700; // 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n"); From 47299a91d10683daf57dbad9661ac78da871df4b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 09:28:10 -0400 Subject: [PATCH 116/125] Update main.c sleep prints --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index b64a4e59..ac14ed71 100644 --- a/main.c +++ b/main.c @@ -1195,7 +1195,7 @@ void get_tlm_fox() { sleep(0.1); // 25); // 0.5); // 25); // sleep((unsigned int)sleepTime); /**/ - printf("Sleep period: %d while period: %d\n", millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset); + printf("Start sleep %d Sleep period: %d while period: %d\n", startSleep, millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset); fflush(stdout); sampleTime = (unsigned int) millis(); From aca3625b0f0c9226512653515469dfdc56bf2923 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 09:35:52 -0400 Subject: [PATCH 117/125] Update cubesatsim.service increase to 7% --- systemd/cubesatsim.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/cubesatsim.service b/systemd/cubesatsim.service index 11966c22..1101dc9e 100644 --- a/systemd/cubesatsim.service +++ b/systemd/cubesatsim.service @@ -10,7 +10,7 @@ StandardError=inherit Restart=always User=root CPUAccounting=true -CPUQuota=5% +CPUQuota=7% [Install] WantedBy=default.target From 0ff8ae7716153372e604e1b633271ca892a0706e Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 09:47:08 -0400 Subject: [PATCH 118/125] Update main.c debug payload read --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index ac14ed71..d0dc9df4 100644 --- a/main.c +++ b/main.c @@ -1980,7 +1980,7 @@ int get_payload_serial(int debug_camera) { if (serialDataAvail(uart_fd)) { char octet = (char) serialGetchar(uart_fd); -// printf("%c", octet); + printf("%c", octet); fflush(stdout); if (start_flag_complete) { @@ -1996,7 +1996,7 @@ int get_payload_serial(int debug_camera) { if (flag_count >= strlen(end_flag)) { // complete image index1 -= strlen(end_flag); buffer2[index1++] = 0; -// printf(" Payload length: %d \n",index1); + printf(" Payload length: %d \n",index1); // write_jpg(); finished = TRUE; From 95607a19a2d4f5bb1fb7b1a9145ecf0850edf720 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 10:02:41 -0400 Subject: [PATCH 119/125] Update main.h reduce camera timeout to 1s --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 92c2e3f4..20d9b090 100644 --- a/main.h +++ b/main.h @@ -184,7 +184,7 @@ int start_flag_detected = FALSE; int start_flag_complete = FALSE; int end_flag_detected = FALSE; int jpeg_start = 0; -#define CAMERA_TIMEOUT 2000 // 10000 // 20000 // Payload timeout in milli seconds +#define CAMERA_TIMEOUT 1000 // 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); int battery_saver_check(); From fa628ee0100ae26a923a7f7448def0880fb12f9b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 10:03:28 -0400 Subject: [PATCH 120/125] Update main.h change payload timeout to 1.5 s --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 20d9b090..531d32e0 100644 --- a/main.h +++ b/main.h @@ -184,7 +184,7 @@ int start_flag_detected = FALSE; int start_flag_complete = FALSE; int end_flag_detected = FALSE; int jpeg_start = 0; -#define CAMERA_TIMEOUT 1000 // 2000 // 10000 // 20000 // Payload timeout in milli seconds +#define CAMERA_TIMEOUT 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); int battery_saver_check(); From 3f2eb6c061eaa10c2d3257ec1cd74eb58ef1db49 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 11:16:31 -0400 Subject: [PATCH 121/125] Update main.h payload timeout back to 2s --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index 531d32e0..bb1eb31f 100644 --- a/main.h +++ b/main.h @@ -184,7 +184,7 @@ int start_flag_detected = FALSE; int start_flag_complete = FALSE; int end_flag_detected = FALSE; int jpeg_start = 0; -#define CAMERA_TIMEOUT 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds +#define CAMERA_TIMEOUT 2000 // 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds void battery_saver(int setting); int battery_saver_check(); From 9ce364ed7b9c6c67ab724751aafd9407cbcec2e9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 17:21:33 -0400 Subject: [PATCH 122/125] Update main.c get payload --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d0dc9df4..829900e2 100644 --- a/main.c +++ b/main.c @@ -381,7 +381,10 @@ int main(int argc, char * argv[]) { if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 printf("Serial opened to Pico\n"); -// payload = ON; +// payload = ON; + payload = get_payload_serial(FALSE); + printf("get_payload_status: %d \n", payload); // not debug + } else { fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno)); } @@ -614,7 +617,7 @@ int main(int argc, char * argv[]) { // if ((payload == ON) && (mode != BPSK)) { // moved to here // STEMBoardFailure = 0; payload = get_payload_serial(FALSE); -// printf("get_payload_status: %d \n", payload); // not debug + printf("get_payload_status: %d \n", payload); // not debug fflush(stdout); // printf("String: %s\n", buffer2); fflush(stdout); From 70aac04d4d6af6fe68c5d255488d5df2aee4f3bc Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Fri, 5 Jul 2024 17:25:55 -0400 Subject: [PATCH 123/125] Update main.c print opening serial --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 829900e2..8f03c580 100644 --- a/main.c +++ b/main.c @@ -378,12 +378,12 @@ int main(int argc, char * argv[]) { if (!ax5043) // don't test for payload if AX5043 is present { payload = OFF; - + fprintf(stderr,"Opening serial\n"); if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 - printf("Serial opened to Pico\n"); + fprintf(stderr,"Serial opened to Pico\n"); // payload = ON; payload = get_payload_serial(FALSE); - printf("get_payload_status: %d \n", payload); // not debug + fprintf(stderr,"Get_payload_status: %d \n", payload); // not debug } else { fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno)); From 8bd98edd3c295e38cff42c32c7ede32e1ccf6304 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 6 Jul 2024 08:39:42 -0400 Subject: [PATCH 124/125] Update command remove downsampling --- command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command b/command index f9a7998e..1f72333c 100755 --- a/command +++ b/command @@ -36,11 +36,11 @@ if [[ $(arecord -l | grep card) ]] && [ -f "$FILE" ]; then echo "debug mode" - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d else - direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l -D 4 | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py + direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py fi else From b4e84264dc4529436cd1ebf02e0aa0b0171e2848 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 7 Jul 2024 09:39:06 -0400 Subject: [PATCH 125/125] Update main.c change pi zero 2 offset to 500 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 8f03c580..11fd4f0d 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char * argv[]) { sleep(5); // try sleep at start to help boot // voltageThreshold = 3.7; printf("Pi Zero 2 detected\n"); - pi_zero_2_offset = 700; // 500; + pi_zero_2_offset = 500; } printf("\n\nCubeSatSim v1.3.2 starting...\n\n");