-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpfsPro.py
62 lines (51 loc) · 1.93 KB
/
pfsPro.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#importing sensors code, here its printing smth for testing
from sensorloop import main
import subprocess
import threading
#install pkgs
def pkgInstall():
# radio pkgs
subprocess.run("conda install -c conda-forge gnuradio", shell = True)
subprocess.run("conda install -c conda-forge gnuradio-osmosdr", shell = True)
subprocess.run("conda install -c conda-forge sip", shell = True)
subprocess.run("conda install -c conda-forge pyqt5-sip", shell = True)
subprocess.run("conda install -c conda-forge gnuradio-qtgui", shell = True)
subprocess.run("conda install -c conda-forge argparse", shell = True)
subprocess.run("conda install -c conda-forge hackrf", shell=True)
# sensor pkgs
subprocess.run("sudo apt-get install i2c-tools", shell = True)
subprocess.run("sudo pip3 install RPi.bme280", shell = True)
subprocess.run("sudo pip3 install adafruit-circuitpython-bno055", shell = True)
subprocess.run("sudo pip3 install adafruit-circuitpython-dps310", shell = True)
print("Pkgs installed")
i=0
def HackRF():
#try:
# f = open("sweep.txt","x")
#except FileExistsError:
# f = open("sweep.txt","a")
#f.close()
subprocess.Popen("hackrf_sweep -r 'sweep{}.txt' ".format(i), shell=True)
try:
print("entered try main")
while True:
try:
i+=1
# HackRF init
#threadHackRF = threading.Thread(target = HackRF)
# sensor init
#sensorThread = threading.Thread(target = main)
# starting HackRF init
#threadHackRF.start()
# starting sensor init
#sensorThread.start()
HackRF()
main()
except ModuleNotFoundError:
# reinstall pkgs
print("installing pkgs")
pkgInstall()
except:
print("Program terminated: Flight ended")
#threadHackRF.join()
#sensorThread.join()