From 56f3f089a143db656f9a3ac527c3533667756d69 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Thu, 30 Apr 2020 22:54:44 +0200 Subject: [PATCH] fix debugging; synchronize startup --- owrx/connection.py | 3 --- owrx/dsp.py | 10 ++++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/owrx/connection.py b/owrx/connection.py index 07c32ae..bd020ed 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -229,7 +229,6 @@ class OpenWebRxReceiverClient(Client): def startDsp(self): while True: - logger.debug("starting dsp...") self.getDsp().start() if self.sdr.getState() == SdrSource.STATE_FAILED: 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() def stopDsp(self): - logger.debug("stopDsp") if self.dsp is not None: self.dsp.stop() self.dsp = None @@ -270,7 +268,6 @@ class OpenWebRxReceiverClient(Client): def getDsp(self): if self.dsp is None: - logger.debug("new DSP") self.dsp = DspManager(self, self.sdr) return self.dsp diff --git a/owrx/dsp.py b/owrx/dsp.py index 979011e..cc94097 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -130,14 +130,17 @@ class DspManager(csdr.output): self.props.wireProperty("secondary_offset_freq", self.dsp.set_secondary_offset_freq), ] + self.startOnAvailable = False + self.sdrSource.addClient(self) super().__init__() def start(self): - logger.debug(self.sdrSource) if self.sdrSource.isAvailable(): self.dsp.start() + else: + self.startOnAvailable = True def receive_output(self, t, read_fn): logger.debug("adding new output of type %s", t) @@ -156,6 +159,7 @@ class DspManager(csdr.output): def stop(self): self.dsp.stop() + self.startOnAvailable = False self.sdrSource.removeClient(self) for sub in self.subscriptions: sub.cancel() @@ -174,7 +178,9 @@ class DspManager(csdr.output): def onStateChange(self, state): if state == SdrSource.STATE_RUNNING: 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: logger.debug("received STATE_STOPPING, shutting down DspSource") self.dsp.stop()