fix dsp unavailability problems

This commit is contained in:
Jakob Ketterl 2019-05-11 00:38:46 +02:00
parent c7e4d6b976
commit 8617997e23
2 changed files with 11 additions and 5 deletions

View File

@ -114,12 +114,16 @@ class OpenWebRxClient(object):
config["start_offset_freq"] = self.configProps["start_freq"] - self.configProps["center_freq"] config["start_offset_freq"] = self.configProps["start_freq"] - self.configProps["center_freq"]
self.write_config(config) self.write_config(config)
def setSdr(self, id = None): def setSdr(self, id = None):
next = SdrService.getSource(id)
if (next == self.sdr):
return
self.stopDsp() self.stopDsp()
if self.configProps is not None: if self.configProps is not None:
self.configProps.unwire(self.sendConfig) self.configProps.unwire(self.sendConfig)
self.sdr = SdrService.getSource(id) self.sdr = next
# send initial config # send initial config
self.configProps = self.sdr.getProps().collect(*OpenWebRxClient.config_keys).defaults(PropertyManager.getSharedInstance()) self.configProps = self.sdr.getProps().collect(*OpenWebRxClient.config_keys).defaults(PropertyManager.getSharedInstance())

View File

@ -427,6 +427,7 @@ class DspManager(object):
self.localProps.getProperty(prop).setValue(value) self.localProps.getProperty(prop).setValue(value)
def onSdrAvailable(self): def onSdrAvailable(self):
logger.debug("received onSdrAvailable, attempting DspSource restart")
if not self.doRun: if not self.doRun:
self.doRun = True self.doRun = True
if self.dsp is not None: if self.dsp is not None:
@ -435,6 +436,7 @@ class DspManager(object):
threading.Thread(target = self.readSMeterOutput).start() threading.Thread(target = self.readSMeterOutput).start()
def onSdrUnavailable(self): def onSdrUnavailable(self):
logger.debug("received onSdrUnavailable, shutting down DspSource")
if self.dsp is not None: if self.dsp is not None:
self.dsp.stop() self.dsp.stop()