introduce a fake tuning indicator for modes without bandpass

This commit is contained in:
Jakob Ketterl 2024-02-12 22:28:36 +01:00
parent 92c09b08e4
commit 58b0ce5636
5 changed files with 27 additions and 11 deletions

View File

@ -15,8 +15,6 @@ Filter.prototype.getLimits = function() {
max_bw = 50000; max_bw = 50000;
} else if (this.demodulator.get_modulation() === "freedv") { } else if (this.demodulator.get_modulation() === "freedv") {
max_bw = 4000; max_bw = 4000;
} else if (this.demodulator.get_modulation() === "dab") {
max_bw = 1000000;
} else if (this.demodulator.get_secondary_demod() === "ism") { } else if (this.demodulator.get_secondary_demod() === "ism") {
max_bw = 600000; max_bw = 600000;
} else { } else {
@ -56,8 +54,13 @@ Envelope.prototype.draw = function(visible_range){
var fake_indicator = !this.demodulator.low_cut || !this.demodulator.high_cut; var fake_indicator = !this.demodulator.low_cut || !this.demodulator.high_cut;
if (fake_indicator) { if (fake_indicator) {
// fake values just so that the tuning indicator shows up // fake values just so that the tuning indicator shows up
from -= 100000; var fixedBw = 100000
to += 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 { } else {
from += this.demodulator.low_cut; from += this.demodulator.low_cut;
to += this.demodulator.high_cut; to += this.demodulator.high_cut;
@ -231,10 +234,9 @@ function Demodulator(offset_frequency, modulation) {
this.state = {}; this.state = {};
this.secondary_demod = false; this.secondary_demod = false;
var mode = Modes.findByModulation(modulation); var mode = Modes.findByModulation(modulation);
if (mode && mode.bandpass) { this.low_cut = mode && mode.bandpass && mode.bandpass.low_cut;
this.low_cut = mode.bandpass.low_cut; this.high_cut = mode && mode.bandpass && mode.bandpass.high_cut;
this.high_cut = mode.bandpass.high_cut; this.ifRate = mode && mode.ifRate;
}
this.listeners = { this.listeners = {
"frequencychange": [], "frequencychange": [],
"squelchchange": [] "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) { Demodulator.prototype.set_secondary_demod = function(secondary_demod) {
if (this.secondary_demod === secondary_demod) { if (this.secondary_demod === secondary_demod) {
return; return;

View File

@ -142,6 +142,8 @@ DemodulatorPanel.prototype.setMode = function(requestedModulation, underlyingMod
} else { } else {
this.demodulator.disableBandpass(); this.demodulator.disableBandpass();
} }
var ifRate = mode.ifRate || (uMode && uMode.ifRate);
this.demodulator.setIfRate(ifRate);
} else { } else {
this.demodulator.set_secondary_demod(false); this.demodulator.set_secondary_demod(false);
} }

View File

@ -41,6 +41,9 @@ var Mode = function(json){
if (json.bandpass) { if (json.bandpass) {
this.bandpass = json.bandpass; this.bandpass = json.bandpass;
} }
if (json.ifRate) {
this.ifRate = json.ifRate;
}
if (this.type === 'digimode') { if (this.type === 'digimode') {
this.underlying = json.underlying; this.underlying = json.underlying;
this.secondaryFft = json.secondaryFft; this.secondaryFft = json.secondaryFft;

View File

@ -442,6 +442,8 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
} }
if m.bandpass is not None: if m.bandpass is not None:
res["bandpass"] = {"low_cut": m.bandpass.low_cut, "high_cut": m.bandpass.high_cut} 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): if isinstance(m, DigitalMode):
res["underlying"] = m.underlying res["underlying"] = m.underlying
res["secondaryFft"] = m.secondaryFft res["secondaryFft"] = m.secondaryFft

View File

@ -11,12 +11,13 @@ class Bandpass(object):
class Mode: 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.modulation = modulation
self.name = name self.name = name
self.requirements = requirements if requirements is not None else [] self.requirements = requirements if requirements is not None else []
self.service = service self.service = service
self.bandpass = bandpass self.bandpass = bandpass
self.ifRate = ifRate
self.squelch = squelch self.squelch = squelch
def is_available(self): def is_available(self):
@ -47,12 +48,13 @@ class DigitalMode(Mode):
name, name,
underlying, underlying,
bandpass: Bandpass = None, bandpass: Bandpass = None,
ifRate = None,
requirements=None, requirements=None,
service=False, service=False,
squelch=True, squelch=True,
secondaryFft=True secondaryFft=True
): ):
super().__init__(modulation, name, bandpass, requirements, service, squelch) super().__init__(modulation, name, bandpass, ifRate, requirements, service, squelch)
self.underlying = underlying self.underlying = underlying
self.secondaryFft = secondaryFft self.secondaryFft = secondaryFft
@ -132,7 +134,7 @@ class Modes(object):
"freedv", "FreeDV", bandpass=Bandpass(300, 3000), requirements=["digital_voice_freedv"], squelch=False "freedv", "FreeDV", bandpass=Bandpass(300, 3000), requirements=["digital_voice_freedv"], squelch=False
), ),
AnalogMode("drm", "DRM", bandpass=Bandpass(-5000, 5000), requirements=["drm"], 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("bpsk31", "BPSK31", underlying=["usb"]),
DigitalMode("bpsk63", "BPSK63", underlying=["usb"]), DigitalMode("bpsk63", "BPSK63", underlying=["usb"]),
DigitalMode("rtty170", "RTTY 45/170", underlying=["usb", "lsb"]), DigitalMode("rtty170", "RTTY 45/170", underlying=["usb", "lsb"]),
@ -171,6 +173,7 @@ class Modes(object):
"ADS-B", "ADS-B",
underlying=["empty"], underlying=["empty"],
bandpass=None, bandpass=None,
ifRate=2.4e6,
requirements=["dump1090"], requirements=["dump1090"],
service=True, service=True,
squelch=False, squelch=False,