save some cpu cycles by only running necessary stuff for services
This commit is contained in:
@ -14,17 +14,15 @@ class ServiceOutput(output):
|
||||
def __init__(self, frequency):
|
||||
self.frequency = frequency
|
||||
|
||||
def add_output(self, t, read_fn):
|
||||
if t == "wsjt_demod":
|
||||
parser = WsjtParser(WsjtHandler())
|
||||
parser.setDialFrequency(self.frequency)
|
||||
target = self.pump(read_fn, parser.parse)
|
||||
else:
|
||||
# dump everything else
|
||||
# TODO rewrite the output mechanism in a way that avoids producing unnecessary data
|
||||
target = self.pump(read_fn, lambda x: None)
|
||||
def receive_output(self, t, read_fn):
|
||||
parser = WsjtParser(WsjtHandler())
|
||||
parser.setDialFrequency(self.frequency)
|
||||
target = self.pump(read_fn, parser.parse)
|
||||
threading.Thread(target=target).start()
|
||||
|
||||
def supports_type(self, t):
|
||||
return t == 'wsjt_demod'
|
||||
|
||||
|
||||
class ServiceHandler(object):
|
||||
def __init__(self, source):
|
||||
|
@ -376,7 +376,7 @@ class SpectrumThread(csdr.output):
|
||||
if self.sdrSource.isAvailable():
|
||||
self.dsp.start()
|
||||
|
||||
def add_output(self, type, read_fn):
|
||||
def receive_output(self, type, read_fn):
|
||||
if type != "audio":
|
||||
logger.error("unsupported output type received by FFT: %s", type)
|
||||
return
|
||||
@ -503,7 +503,7 @@ class DspManager(csdr.output):
|
||||
if self.sdrSource.isAvailable():
|
||||
self.dsp.start()
|
||||
|
||||
def add_output(self, t, read_fn):
|
||||
def receive_output(self, t, read_fn):
|
||||
logger.debug("adding new output of type %s", t)
|
||||
writers = {
|
||||
"audio": self.handler.write_dsp_data,
|
||||
|
Reference in New Issue
Block a user