restart demodulator based on modes
This commit is contained in:
parent
26ba8ca999
commit
e92a91663d
@ -2,6 +2,7 @@ function DemodulatorPanel(el) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
self.el = el;
|
self.el = el;
|
||||||
self.demodulator = null;
|
self.demodulator = null;
|
||||||
|
self.mode = null;
|
||||||
|
|
||||||
var displayEl = el.find('.webrx-actual-freq')
|
var displayEl = el.find('.webrx-actual-freq')
|
||||||
this.tuneableFrequencyDisplay = displayEl.tuneableFrequencyDisplay();
|
this.tuneableFrequencyDisplay = displayEl.tuneableFrequencyDisplay();
|
||||||
@ -82,32 +83,32 @@ DemodulatorPanel.prototype.setMode = function(modulation) {
|
|||||||
if (!mode) {
|
if (!mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.mode === mode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!mode.isAvailable()) {
|
if (!mode.isAvailable()) {
|
||||||
divlog('Modulation "' + mode.name + '" not supported. Please check requirements', true);
|
divlog('Modulation "' + mode.name + '" not supported. Please check requirements', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.mode = mode;
|
||||||
|
|
||||||
if (mode.type === 'digimode') {
|
if (mode.type === 'digimode') {
|
||||||
modulation = mode.underlying[0];
|
modulation = mode.underlying[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
var current_offset_frequency = 0;
|
var current_offset_frequency = 0;
|
||||||
var current_modulation = false;
|
|
||||||
if (this.demodulator) {
|
if (this.demodulator) {
|
||||||
current_modulation = this.demodulator.get_modulation();
|
|
||||||
current_offset_frequency = this.demodulator.get_offset_frequency();
|
current_offset_frequency = this.demodulator.get_offset_frequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
var replace_modulator = current_modulation !== modulation;
|
this.stopDemodulator();
|
||||||
if (replace_modulator) {
|
this.demodulator = new Demodulator(current_offset_frequency, modulation);
|
||||||
this.stopDemodulator();
|
var self = this;
|
||||||
this.demodulator = new Demodulator(current_offset_frequency, modulation);
|
this.demodulator.on("frequencychange", function(freq) {
|
||||||
var self = this;
|
self.tuneableFrequencyDisplay.setFrequency(self.center_freq + freq);
|
||||||
this.demodulator.on("frequencychange", function(freq) {
|
self.updateHash();
|
||||||
self.tuneableFrequencyDisplay.setFrequency(self.center_freq + freq);
|
});
|
||||||
self.updateHash();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (mode.type === 'digimode') {
|
if (mode.type === 'digimode') {
|
||||||
this.demodulator.set_secondary_demod(mode.modulation);
|
this.demodulator.set_secondary_demod(mode.modulation);
|
||||||
if (mode.bandpass) {
|
if (mode.bandpass) {
|
||||||
@ -117,9 +118,7 @@ DemodulatorPanel.prototype.setMode = function(modulation) {
|
|||||||
this.demodulator.set_secondary_demod(false);
|
this.demodulator.set_secondary_demod(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replace_modulator) {
|
this.demodulator.start();
|
||||||
this.demodulator.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateButtons();
|
this.updateButtons();
|
||||||
this.updatePanels();
|
this.updatePanels();
|
||||||
@ -127,8 +126,7 @@ DemodulatorPanel.prototype.setMode = function(modulation) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.disableDigiMode = function() {
|
DemodulatorPanel.prototype.disableDigiMode = function() {
|
||||||
var modulation = this.el.find('.openwebrx-button.highlighted[data-modulation]').data('modulation');
|
this.setMode(this.getDemodulator().get_modulation());
|
||||||
this.setMode(modulation);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DemodulatorPanel.prototype.updatePanels = function() {
|
DemodulatorPanel.prototype.updatePanels = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user