From de41b6c66fae7e1dc732a2dbe16e01bda5820cab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 18 Feb 2024 09:22:36 -0500 Subject: [PATCH] Update rpitx.py add command_control check --- rpitx.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rpitx.py b/rpitx.py index ccdb6038..41df0ec1 100644 --- a/rpitx.py +++ b/rpitx.py @@ -153,14 +153,6 @@ GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(txc_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(green, GPIO.OUT) -GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected - -if GPIO.input(squelch) == False: - print("squelch not set correctly, no command input!") - no_command = True -else: - no_command = False - transmit = False if GPIO.input(12) == False: print("Version is v1 with UHF BPF") @@ -311,6 +303,23 @@ if __name__ == "__main__": if (debug_mode == 1): print("Can't read callsign from sim.cfg file, defaulting to AMSAT") file.close() + + try: + f = open("/home/pi/CubeSatSim/command_control", "r") + f.close() + 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 + if GPIO.input(squelch) == False: + print("squelch not set correctly, no command input!") + no_command = True + else: + print("command and control is activated") + no_command = False + except: + print("command and control not activated") + no_command = True + print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT)