diff --git a/htdocs/lib/Demodulator.js b/htdocs/lib/Demodulator.js index c4347af0..4d7ebcba 100644 --- a/htdocs/lib/Demodulator.js +++ b/htdocs/lib/Demodulator.js @@ -15,8 +15,6 @@ Filter.prototype.getLimits = function() { max_bw = 50000; } else if (this.demodulator.get_modulation() === "freedv") { max_bw = 4000; - } else if (this.demodulator.get_modulation() === "dab") { - max_bw = 1000000; } else if (this.demodulator.get_secondary_demod() === "ism") { max_bw = 600000; } else { @@ -56,8 +54,13 @@ Envelope.prototype.draw = function(visible_range){ var fake_indicator = !this.demodulator.low_cut || !this.demodulator.high_cut; if (fake_indicator) { // fake values just so that the tuning indicator shows up - from -= 100000; - to += 100000; + var fixedBw = 100000 + // if we know the if rate, we can display that + if (this.demodulator.ifRate) { + fixedBw = this.demodulator.ifRate / 2; + } + from -= fixedBw; + to += fixedBw; } else { from += this.demodulator.low_cut; to += this.demodulator.high_cut; @@ -231,10 +234,9 @@ function Demodulator(offset_frequency, modulation) { this.state = {}; this.secondary_demod = false; var mode = Modes.findByModulation(modulation); - if (mode && mode.bandpass) { - this.low_cut = mode.bandpass.low_cut; - this.high_cut = mode.bandpass.high_cut; - } + this.low_cut = mode && mode.bandpass && mode.bandpass.low_cut; + this.high_cut = mode && mode.bandpass && mode.bandpass.high_cut; + this.ifRate = mode && mode.ifRate; this.listeners = { "frequencychange": [], "squelchchange": [] @@ -390,6 +392,10 @@ Demodulator.prototype.getBandpass = function() { }; }; +Demodulator.prototype.setIfRate = function(ifRate) { + this.ifRate = ifRate; +}; + Demodulator.prototype.set_secondary_demod = function(secondary_demod) { if (this.secondary_demod === secondary_demod) { return; diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index 46a5d5db..6f35e6b7 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -142,6 +142,8 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingMod } else { this.demodulator.disableBandpass(); } + var ifRate = mode.ifRate || (uMode && uMode.ifRate); + this.demodulator.setIfRate(ifRate); } else { this.demodulator.set_secondary_demod(false); } diff --git a/htdocs/lib/Modes.js b/htdocs/lib/Modes.js index ee82b7d7..0bdac90b 100644 --- a/htdocs/lib/Modes.js +++ b/htdocs/lib/Modes.js @@ -41,6 +41,9 @@ var Mode = function(json){ if (json.bandpass) { this.bandpass = json.bandpass; } + if (json.ifRate) { + this.ifRate = json.ifRate; + } if (this.type === 'digimode') { this.underlying = json.underlying; this.secondaryFft = json.secondaryFft; diff --git a/owrx/connection.py b/owrx/connection.py index 31d19ba6..0350e155 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -442,6 +442,8 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): } if m.bandpass is not None: res["bandpass"] = {"low_cut": m.bandpass.low_cut, "high_cut": m.bandpass.high_cut} + if m.ifRate is not None: + res["ifRate"] = m.ifRate if isinstance(m, DigitalMode): res["underlying"] = m.underlying res["secondaryFft"] = m.secondaryFft diff --git a/owrx/modes.py b/owrx/modes.py index c6f07a9d..f5ea047e 100644 --- a/owrx/modes.py +++ b/owrx/modes.py @@ -11,12 +11,13 @@ class Bandpass(object): class Mode: - def __init__(self, modulation: str, name: str, bandpass: Bandpass = None, requirements=None, service=False, squelch=True): + def __init__(self, modulation: str, name: str, bandpass: Bandpass = None, ifRate=None, requirements=None, service=False, squelch=True): self.modulation = modulation self.name = name self.requirements = requirements if requirements is not None else [] self.service = service self.bandpass = bandpass + self.ifRate = ifRate self.squelch = squelch def is_available(self): @@ -47,12 +48,13 @@ class DigitalMode(Mode): name, underlying, bandpass: Bandpass = None, + ifRate = None, requirements=None, service=False, squelch=True, secondaryFft=True ): - super().__init__(modulation, name, bandpass, requirements, service, squelch) + super().__init__(modulation, name, bandpass, ifRate, requirements, service, squelch) self.underlying = underlying self.secondaryFft = secondaryFft @@ -132,7 +134,7 @@ class Modes(object): "freedv", "FreeDV", bandpass=Bandpass(300, 3000), requirements=["digital_voice_freedv"], squelch=False ), AnalogMode("drm", "DRM", bandpass=Bandpass(-5000, 5000), requirements=["drm"], squelch=False), - AnalogMode("dab", "DAB", bandpass=None, requirements=["dab"], squelch=False), + AnalogMode("dab", "DAB", bandpass=None, ifRate=2.048e6, requirements=["dab"], squelch=False), DigitalMode("bpsk31", "BPSK31", underlying=["usb"]), DigitalMode("bpsk63", "BPSK63", underlying=["usb"]), DigitalMode("rtty170", "RTTY 45/170", underlying=["usb", "lsb"]), @@ -171,6 +173,7 @@ class Modes(object): "ADS-B", underlying=["empty"], bandpass=None, + ifRate=2.4e6, requirements=["dump1090"], service=True, squelch=False,