-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain2.py
44 lines (32 loc) · 998 Bytes
/
main2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import SOCS
import RPi.GPIO as GPIO
# Command line arguments
import argparse
# Necessary to prevent import issues on APRSInterface
import sys
sys.path.append("./aprs_decoding/test")
# APRS Interface
if True:
from APRSInterface import APRSInterface
# Program description
msg = "Main HPRC Payload Program."
# Initialize parser
parser = argparse.ArgumentParser(description=msg)
# Adding APRS frequency argument
parser.add_argument("-f", "--Frequency", help="APRS Frequency in MHz")
args = parser.parse_args()
def main(args):
if args.Frequency:
payload = SOCS.PayloadSystem(frequency=args.Frequency)
else:
payload = SOCS.PayloadSystem()
try:
while payload.state is not payload.LaunchState.RECOVER:
payload.update()
except KeyboardInterrupt:
if payload.aprs_interface.running:
payload.aprs_interface.stop()
pass
print("Program complete. Waiting for recovery.")
if __name__ == "__main__":
main(args)