Changed to sync sleep
This commit is contained in:
@@ -2,6 +2,7 @@ import threading
|
||||
import subprocess
|
||||
import asyncio
|
||||
import os
|
||||
import time
|
||||
|
||||
|
||||
class OP25Handler: #(threading.Thread):
|
||||
@@ -12,12 +13,16 @@ class OP25Handler: #(threading.Thread):
|
||||
|
||||
self.Frequency = None
|
||||
|
||||
self.HTTP_ENABLED = False
|
||||
|
||||
def start(self) -> None:
|
||||
self.open_op25()
|
||||
|
||||
def set_op25_parameters(self, _frequency):
|
||||
def set_op25_parameters(self, _frequency, _http_enabled: bool = False):
|
||||
self.Frequency = _frequency
|
||||
|
||||
self.HTTP_ENABLED = _http_enabled
|
||||
|
||||
def open_op25(self):
|
||||
if self.OP25Proc is not None:
|
||||
self.close_op25()
|
||||
@@ -25,15 +30,17 @@ class OP25Handler: #(threading.Thread):
|
||||
print(f"Starting OP25")
|
||||
|
||||
cwd = os.getcwd()
|
||||
print(cwd)
|
||||
|
||||
os.chdir(self.OP25Dir)
|
||||
|
||||
print(os.getcwd())
|
||||
if self.HTTP_ENABLED:
|
||||
self.OP25Proc = subprocess.Popen([f"./rx.py", "--args", "rtl", "-N", "LNA:49", "-s",
|
||||
"200000", "-o", "25600", "-U", "-f", f"{self.Frequency}e6", "-X", "-2",
|
||||
"-l" "http:0.0.0.0:8080"])
|
||||
|
||||
self.OP25Proc = subprocess.Popen([f"./rx.py", "--args", "rtl", "-N", "LNA:49", "-s",
|
||||
"200000", "-o", "25600", "-U", "-f", f"{self.Frequency}e6", "-X", "-2",
|
||||
"-l" "http:0.0.0.0:8080"])
|
||||
else:
|
||||
self.OP25Proc = subprocess.Popen([f"./rx.py", "--args", "rtl", "-N", "LNA:49", "-s",
|
||||
"200000", "-o", "25600", "-U", "-f", f"{self.Frequency}e6", "-X", "-2"])
|
||||
|
||||
os.chdir(cwd)
|
||||
|
||||
@@ -48,7 +55,7 @@ class OP25Handler: #(threading.Thread):
|
||||
if seconds_waited % 5 == 0:
|
||||
print("Terminating OP25")
|
||||
self.OP25Proc.terminate()
|
||||
asyncio.sleep(1000)
|
||||
time.sleep(1)
|
||||
print(f"Waited {seconds_waited} seconds")
|
||||
seconds_waited += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user