|
|
|
|
@ -12,6 +12,7 @@ if __name__ == "__main__":
|
|
|
|
|
txLed = 27
|
|
|
|
|
change_mode = False
|
|
|
|
|
debug_mode = False
|
|
|
|
|
counter = 1
|
|
|
|
|
if (len(sys.argv)) > 1:
|
|
|
|
|
# print("There are arguments!")
|
|
|
|
|
if ('d' == sys.argv[1]):
|
|
|
|
|
@ -25,43 +26,58 @@ if __name__ == "__main__":
|
|
|
|
|
# if '^c' == line.rstrip():
|
|
|
|
|
# break
|
|
|
|
|
|
|
|
|
|
if ((line.find("MODE=a")) > 0) or ((line.find("DTMF>APDW15:t1#")) > 0):
|
|
|
|
|
if ((line.find("MODE=a")) > 0):
|
|
|
|
|
system("echo '\nAPRS Mode!!\n'")
|
|
|
|
|
mode = 'a'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=f")) > 0) or ((line.find("DTMF>APDW15:t2#")) > 0):
|
|
|
|
|
counter = (counter + 1) % 2
|
|
|
|
|
if ((line.find("DTMF>APDW15:t1#")) > 0):
|
|
|
|
|
system("echo '\nAPRS Mode!!\n'")
|
|
|
|
|
mode = 'a'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=f")) > 0):
|
|
|
|
|
system("echo '\nFSK Mode!!\n'")
|
|
|
|
|
mode = 'f'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=b")) > 0) or ((line.find("DTMF>APDW15:t3#")) > 0):
|
|
|
|
|
counter = (counter + 1) % 2
|
|
|
|
|
if ((line.find("DTMF>APDW15:t2#")) > 0):
|
|
|
|
|
system("echo '\nFSK Mode!!\n'")
|
|
|
|
|
mode = 'f'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=b")) > 0):
|
|
|
|
|
system("echo '\nBPSK Mode!!\n'")
|
|
|
|
|
mode = 'b'
|
|
|
|
|
change_mode = True
|
|
|
|
|
counter = (counter + 1) % 2
|
|
|
|
|
if ((line.find("DTMF>APDW15:t3#")) > 0):
|
|
|
|
|
system("echo '\nBPSK Mode!!\n'")
|
|
|
|
|
mode = 'b'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=s")) > 0) or ((line.find("DTMF>APDW15:t4#")) > 0):
|
|
|
|
|
if ((line.find("MODE=s")) > 0):
|
|
|
|
|
system("echo '\nSSTV Mode!!\n'")
|
|
|
|
|
mode = 's'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=m")) > 0) or ((line.find("DTMF>APDW15:t5#")) > 0):
|
|
|
|
|
counter = (counter + 1) % 2
|
|
|
|
|
if ((line.find("DTMF>APDW15:t4#")) > 0):
|
|
|
|
|
system("echo '\nSSTV Mode!!\n'")
|
|
|
|
|
mode = 's'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=m")) > 0):
|
|
|
|
|
system("echo '\nCW Mode!!\n'")
|
|
|
|
|
mode = 'm'
|
|
|
|
|
change_mode = True
|
|
|
|
|
if ((line.find("MODE=o")) > 0) or ((line.find("DTMF>APDW15:t10#")) > 0):
|
|
|
|
|
counter = (counter + 1) % 2
|
|
|
|
|
if ((line.find("MODE=o")) > 0):
|
|
|
|
|
system("echo '\nBeacon Mode toggle!!\n'")
|
|
|
|
|
try:
|
|
|
|
|
fm = open("/home/pi/CubeSatSim/beacon_off")
|
|
|
|
|
fm.close()
|
|
|
|
|
system("echo 'Beacon is off, turning it ON'")
|
|
|
|
|
system("sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1")
|
|
|
|
|
except:
|
|
|
|
|
system("echo 'Beacon is on, turning it OFF'")
|
|
|
|
|
system("touch /home/pi/CubeSatSim/beacon_off")
|
|
|
|
|
mode = 'o'
|
|
|
|
|
change_mode = True
|
|
|
|
|
counter = (counter + 1) % 2
|
|
|
|
|
if ((line.find("DTMF>APDW15:t10#")) > 0):
|
|
|
|
|
system("echo '\nBeacon Mode toggle!!\n'")
|
|
|
|
|
mode = 'o'
|
|
|
|
|
change_mode = True
|
|
|
|
|
|
|
|
|
|
system("echo 'Restarting rpitx'")
|
|
|
|
|
system("sudo systemctl restart rpitx")
|
|
|
|
|
# system("echo 'Resuming rpitx'")
|
|
|
|
|
# system("sudo python3 -u /home/pi/CubeSatSim/rpitx.py s & > /dev/null 2>&1")
|
|
|
|
|
change_mode = False
|
|
|
|
|
if (debug_mode == False) and (change_mode == True):
|
|
|
|
|
if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice
|
|
|
|
|
GPIO.setmode(GPIO.BCM)
|
|
|
|
|
GPIO.setwarnings(False)
|
|
|
|
|
GPIO.setup(powerPin, GPIO.OUT)
|
|
|
|
|
@ -130,7 +146,7 @@ if __name__ == "__main__":
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
GPIO.output(powerPin, 1)
|
|
|
|
|
sleep(1)
|
|
|
|
|
else:
|
|
|
|
|
elif (mode == 'a'):
|
|
|
|
|
mode = 'a'
|
|
|
|
|
GPIO.output(powerPin, 0) # blink one time
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
@ -156,7 +172,7 @@ if __name__ == "__main__":
|
|
|
|
|
GPIO.output(txLed, 0)
|
|
|
|
|
GPIO.output(powerPin, 0)
|
|
|
|
|
system("sudo systemctl stop rpitx")
|
|
|
|
|
system("sudo systemctl stop cubesatsim")
|
|
|
|
|
# system("sudo systemctl stop cubesatsim")
|
|
|
|
|
|
|
|
|
|
print("\n/home/pi/CubeSatSim/config -" + mode)
|
|
|
|
|
system("/home/pi/CubeSatSim/config -" + mode)
|
|
|
|
|
|