diff --git a/csdr/chain/demodulator.py b/csdr/chain/demodulator.py index c72658c3..b16f806d 100644 --- a/csdr/chain/demodulator.py +++ b/csdr/chain/demodulator.py @@ -64,6 +64,9 @@ class SecondaryDemodulator(Chain): def setSampleRate(self, sampleRate: int) -> None: pass + def isSecondaryFftShown(self): + return True + class ServiceDemodulator(SecondaryDemodulator, FixedAudioRateChain, metaclass=ABCMeta): pass diff --git a/csdr/chain/dump1090.py b/csdr/chain/dump1090.py index b298dd3f..ef4989a2 100644 --- a/csdr/chain/dump1090.py +++ b/csdr/chain/dump1090.py @@ -19,3 +19,6 @@ class Dump1090(ServiceDemodulator): def getFixedAudioRate(self) -> int: return 2400000 + + def isSecondaryFftShown(self): + return False diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index d2fe1e46..042e4fe8 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -158,7 +158,8 @@ DemodulatorPanel.prototype.disableDigiMode = function() { DemodulatorPanel.prototype.updatePanels = function() { var modulation = this.getDemodulator().get_secondary_demod(); $('#openwebrx-panel-digimodes').attr('data-mode', modulation); - toggle_panel("openwebrx-panel-digimodes", !!modulation); + var mode = Modes.findByModulation(modulation); + toggle_panel("openwebrx-panel-digimodes", modulation && (!mode || mode.secondaryFft)); toggle_panel("openwebrx-panel-wsjt-message", ['ft8', 'wspr', 'jt65', 'jt9', 'ft4', 'fst4', 'fst4w', "q65", "msk144"].indexOf(modulation) >= 0); toggle_panel("openwebrx-panel-js8-message", modulation === "js8"); toggle_panel("openwebrx-panel-packet-message", modulation === "packet"); diff --git a/htdocs/lib/Modes.js b/htdocs/lib/Modes.js index c68466ae..ee82b7d7 100644 --- a/htdocs/lib/Modes.js +++ b/htdocs/lib/Modes.js @@ -43,6 +43,7 @@ var Mode = function(json){ } if (this.type === 'digimode') { this.underlying = json.underlying; + this.secondaryFft = json.secondaryFft; } }; diff --git a/owrx/connection.py b/owrx/connection.py index 4f47b5cf..e378a664 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -443,6 +443,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): res["bandpass"] = {"low_cut": m.bandpass.low_cut, "high_cut": m.bandpass.high_cut} if isinstance(m, DigitalMode): res["underlying"] = m.underlying + res["secondaryFft"] = m.secondaryFft return res self.send({"type": "modes", "value": [to_json(m) for m in modes]}) diff --git a/owrx/dsp.py b/owrx/dsp.py index b60a4ef8..864d5ea0 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -196,11 +196,11 @@ class ClientDemodulatorChain(Chain): self.secondaryDemodulator.setReader(self.audioBuffer.getReader()) self.secondaryDemodulator.setWriter(self.secondaryWriter) - if self.secondaryDemodulator is None and self.secondaryFftChain is not None: + if (self.secondaryDemodulator is None or not self.secondaryDemodulator.isSecondaryFftShown()) and self.secondaryFftChain is not None: self.secondaryFftChain.stop() self.secondaryFftChain = None - if self.secondaryDemodulator is not None and self.secondaryFftChain is None: + if (self.secondaryDemodulator is not None and self.secondaryDemodulator.isSecondaryFftShown()) and self.secondaryFftChain is None: self._createSecondaryFftChain() if self.secondaryFftChain is not None: diff --git a/owrx/modes.py b/owrx/modes.py index 568ec459..ff60ec34 100644 --- a/owrx/modes.py +++ b/owrx/modes.py @@ -42,10 +42,19 @@ class AnalogMode(Mode): class DigitalMode(Mode): def __init__( - self, modulation, name, underlying, bandpass: Bandpass = None, requirements=None, service=False, squelch=True + self, + modulation, + name, + underlying, + bandpass: Bandpass = None, + requirements=None, + service=False, + squelch=True, + secondaryFft=True ): super().__init__(modulation, name, bandpass, requirements, service, squelch) self.underlying = underlying + self.secondaryFft = secondaryFft def get_underlying_mode(self): mode = Modes.findByModulation(self.underlying[0]) @@ -162,6 +171,7 @@ class Modes(object): bandpass=Bandpass(-1e6, 1e6), requirements=["dump1090"], squelch=False, + secondaryFft=False, ), ]