add the option to disable the scondary fft

This commit is contained in:
Jakob Ketterl 2023-08-24 22:00:59 +02:00
parent 5db5cb9eae
commit cafdb3a9f2
7 changed files with 23 additions and 4 deletions

View file

@ -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

View file

@ -19,3 +19,6 @@ class Dump1090(ServiceDemodulator):
def getFixedAudioRate(self) -> int:
return 2400000
def isSecondaryFftShown(self):
return False

View file

@ -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");

View file

@ -43,6 +43,7 @@ var Mode = function(json){
}
if (this.type === 'digimode') {
this.underlying = json.underlying;
this.secondaryFft = json.secondaryFft;
}
};

View file

@ -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]})

View file

@ -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:

View file

@ -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,
),
]