fix debugging; synchronize startup
This commit is contained in:
parent
1764abe65f
commit
56f3f089a1
@ -229,7 +229,6 @@ class OpenWebRxReceiverClient(Client):
|
|||||||
|
|
||||||
def startDsp(self):
|
def startDsp(self):
|
||||||
while True:
|
while True:
|
||||||
logger.debug("starting dsp...")
|
|
||||||
self.getDsp().start()
|
self.getDsp().start()
|
||||||
if self.sdr.getState() == SdrSource.STATE_FAILED:
|
if self.sdr.getState() == SdrSource.STATE_FAILED:
|
||||||
self.write_log_message('SDR device "{0}" has failed, selecting new device'.format(self.sdr.getName()))
|
self.write_log_message('SDR device "{0}" has failed, selecting new device'.format(self.sdr.getName()))
|
||||||
@ -247,7 +246,6 @@ class OpenWebRxReceiverClient(Client):
|
|||||||
super().close()
|
super().close()
|
||||||
|
|
||||||
def stopDsp(self):
|
def stopDsp(self):
|
||||||
logger.debug("stopDsp")
|
|
||||||
if self.dsp is not None:
|
if self.dsp is not None:
|
||||||
self.dsp.stop()
|
self.dsp.stop()
|
||||||
self.dsp = None
|
self.dsp = None
|
||||||
@ -270,7 +268,6 @@ class OpenWebRxReceiverClient(Client):
|
|||||||
|
|
||||||
def getDsp(self):
|
def getDsp(self):
|
||||||
if self.dsp is None:
|
if self.dsp is None:
|
||||||
logger.debug("new DSP")
|
|
||||||
self.dsp = DspManager(self, self.sdr)
|
self.dsp = DspManager(self, self.sdr)
|
||||||
return self.dsp
|
return self.dsp
|
||||||
|
|
||||||
|
10
owrx/dsp.py
10
owrx/dsp.py
@ -130,14 +130,17 @@ class DspManager(csdr.output):
|
|||||||
self.props.wireProperty("secondary_offset_freq", self.dsp.set_secondary_offset_freq),
|
self.props.wireProperty("secondary_offset_freq", self.dsp.set_secondary_offset_freq),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
self.startOnAvailable = False
|
||||||
|
|
||||||
self.sdrSource.addClient(self)
|
self.sdrSource.addClient(self)
|
||||||
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
logger.debug(self.sdrSource)
|
|
||||||
if self.sdrSource.isAvailable():
|
if self.sdrSource.isAvailable():
|
||||||
self.dsp.start()
|
self.dsp.start()
|
||||||
|
else:
|
||||||
|
self.startOnAvailable = True
|
||||||
|
|
||||||
def receive_output(self, t, read_fn):
|
def receive_output(self, t, read_fn):
|
||||||
logger.debug("adding new output of type %s", t)
|
logger.debug("adding new output of type %s", t)
|
||||||
@ -156,6 +159,7 @@ class DspManager(csdr.output):
|
|||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.dsp.stop()
|
self.dsp.stop()
|
||||||
|
self.startOnAvailable = False
|
||||||
self.sdrSource.removeClient(self)
|
self.sdrSource.removeClient(self)
|
||||||
for sub in self.subscriptions:
|
for sub in self.subscriptions:
|
||||||
sub.cancel()
|
sub.cancel()
|
||||||
@ -174,7 +178,9 @@ class DspManager(csdr.output):
|
|||||||
def onStateChange(self, state):
|
def onStateChange(self, state):
|
||||||
if state == SdrSource.STATE_RUNNING:
|
if state == SdrSource.STATE_RUNNING:
|
||||||
logger.debug("received STATE_RUNNING, attempting DspSource restart")
|
logger.debug("received STATE_RUNNING, attempting DspSource restart")
|
||||||
self.dsp.start()
|
if self.startOnAvailable:
|
||||||
|
self.dsp.start()
|
||||||
|
self.startOnAvailable = False
|
||||||
elif state == SdrSource.STATE_STOPPING:
|
elif state == SdrSource.STATE_STOPPING:
|
||||||
logger.debug("received STATE_STOPPING, shutting down DspSource")
|
logger.debug("received STATE_STOPPING, shutting down DspSource")
|
||||||
self.dsp.stop()
|
self.dsp.stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user