get the s-meter back
This commit is contained in:
parent
7481399908
commit
0f86796e75
1
csdr.py
1
csdr.py
@ -374,7 +374,6 @@ class dsp:
|
||||
self.set_squelch_level(self.squelch_level)
|
||||
if self.smeter_pipe != None:
|
||||
self.smeter_pipe_file=open(self.smeter_pipe,"r")
|
||||
self.set_pipe_nonblocking(self.smeter_pipe_file)
|
||||
|
||||
self.start_secondary_demodulator()
|
||||
|
||||
|
@ -1181,6 +1181,9 @@ function on_ws_recv(evt)
|
||||
waterfall_init();
|
||||
audio_preinit();
|
||||
break;
|
||||
case "smeter":
|
||||
setSmeterAbsoluteValue(json.value);
|
||||
break;
|
||||
default:
|
||||
console.warn('received message of unknown type', json);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import mimetypes
|
||||
from owrx.websocket import WebSocketConnection
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.source import SpectrumThread, DspThread
|
||||
from owrx.source import SpectrumThread, DspManager
|
||||
import json
|
||||
|
||||
class Controller(object):
|
||||
@ -53,6 +53,8 @@ class SpectrumForwarder(object):
|
||||
self.conn.send(bytes([0x01]) + data)
|
||||
def write_dsp_data(self, data):
|
||||
self.conn.send(bytes([0x02]) + data)
|
||||
def write_s_meter_level(self, level):
|
||||
self.conn.send({"type":"smeter","value":level})
|
||||
|
||||
class WebSocketMessageHandler(object):
|
||||
def __init__(self):
|
||||
@ -77,7 +79,7 @@ class WebSocketMessageHandler(object):
|
||||
self.forwarder = SpectrumForwarder(conn)
|
||||
SpectrumThread.getSharedInstance().add_client(self.forwarder)
|
||||
|
||||
self.dsp = DspThread(self.forwarder)
|
||||
self.dsp = DspManager(self.forwarder)
|
||||
|
||||
else:
|
||||
try:
|
||||
|
@ -2,7 +2,6 @@ import subprocess
|
||||
from owrx.config import PropertyManager
|
||||
import threading
|
||||
import csdr
|
||||
import time
|
||||
|
||||
class RtlNmuxSource(object):
|
||||
def __init__(self):
|
||||
@ -88,7 +87,7 @@ class SpectrumThread(threading.Thread):
|
||||
SpectrumThread.sharedInstance = None
|
||||
self.doRun = False
|
||||
|
||||
class DspThread(threading.Thread):
|
||||
class DspManager(object):
|
||||
def __init__(self, handler):
|
||||
self.doRun = True
|
||||
self.handler = handler
|
||||
@ -138,12 +137,21 @@ class DspThread(threading.Thread):
|
||||
|
||||
super().__init__()
|
||||
|
||||
def run(self):
|
||||
def start(self):
|
||||
self.dsp.start()
|
||||
threading.Thread(target = self.readDspOutput).start()
|
||||
threading.Thread(target = self.readSMeterOutput).start()
|
||||
|
||||
def readDspOutput(self):
|
||||
while (self.doRun):
|
||||
data = self.dsp.read(256)
|
||||
self.handler.write_dsp_data(data)
|
||||
|
||||
def readSMeterOutput(self):
|
||||
while (self.doRun):
|
||||
level = self.dsp.get_smeter_level()
|
||||
self.handler.write_s_meter_level(level)
|
||||
|
||||
def stop(self):
|
||||
self.doRun = False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user