From 8617997e23e2d77362cf6d571b20d1da3c37f30c Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 11 May 2019 00:38:46 +0200 Subject: [PATCH] fix dsp unavailability problems --- owrx/controllers.py | 6 +++++- owrx/source.py | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/owrx/controllers.py b/owrx/controllers.py index adc29a2..af4483d 100644 --- a/owrx/controllers.py +++ b/owrx/controllers.py @@ -114,12 +114,16 @@ class OpenWebRxClient(object): config["start_offset_freq"] = self.configProps["start_freq"] - self.configProps["center_freq"] self.write_config(config) def setSdr(self, id = None): + next = SdrService.getSource(id) + if (next == self.sdr): + return + self.stopDsp() if self.configProps is not None: self.configProps.unwire(self.sendConfig) - self.sdr = SdrService.getSource(id) + self.sdr = next # send initial config self.configProps = self.sdr.getProps().collect(*OpenWebRxClient.config_keys).defaults(PropertyManager.getSharedInstance()) diff --git a/owrx/source.py b/owrx/source.py index 64637b2..f918e54 100644 --- a/owrx/source.py +++ b/owrx/source.py @@ -427,14 +427,16 @@ class DspManager(object): self.localProps.getProperty(prop).setValue(value) def onSdrAvailable(self): + logger.debug("received onSdrAvailable, attempting DspSource restart") if not self.doRun: self.doRun = True - if self.dsp is not None: - self.dsp.start() - threading.Thread(target = self.readDspOutput).start() - threading.Thread(target = self.readSMeterOutput).start() + if self.dsp is not None: + self.dsp.start() + threading.Thread(target = self.readDspOutput).start() + threading.Thread(target = self.readSMeterOutput).start() def onSdrUnavailable(self): + logger.debug("received onSdrUnavailable, shutting down DspSource") if self.dsp is not None: self.dsp.stop()