diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index a3a6ca8..aa8de15 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -6,7 +6,7 @@ function DemodulatorPanel(el) { var displayEl = el.find('.webrx-actual-freq') this.tuneableFrequencyDisplay = displayEl.tuneableFrequencyDisplay(); displayEl.on('frequencychange', function(event, freq) { - self.getDemodulator().set_offset_frequency(freq - center_freq); + self.getDemodulator().set_offset_frequency(freq - self.center_freq); }); Modes.registerModePanel(this); @@ -101,7 +101,7 @@ DemodulatorPanel.prototype.setMode = function(modulation) { this.demodulator = new Demodulator(current_offset_frequency, modulation); var self = this; this.demodulator.on("frequencychange", function(freq) { - self.tuneableFrequencyDisplay.setFrequency(center_freq + freq); + self.tuneableFrequencyDisplay.setFrequency(self.center_freq + freq); updateHash(); }); } @@ -187,6 +187,18 @@ DemodulatorPanel.prototype.updateButtons = function() { } } +DemodulatorPanel.prototype.setCenterFrequency = function(center_freq) { + if (this.center_freq === center_freq) { + return ; + } + this.center_freq = center_freq; + var demod = this.getDemodulator(); + if (demod) { + this.tuneableFrequencyDisplay.setFrequency(center_freq + demod.get_offset_frequency()); + } + updateHash(); +}; + $.fn.demodulatorPanel = function(){ if (!this.data('panel')) { this.data('panel', new DemodulatorPanel(this)); diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 19d59c8..971cf65 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -745,6 +745,7 @@ function on_ws_recv(evt) { bandwidth = config['samp_rate']; center_freq = config['center_freq']; + $('#openwebrx-panel-receiver').demodulatorPanel().setCenterFrequency(center_freq); fft_size = config['fft_size']; var audio_compression = config['audio_compression']; audioEngine.setCompression(audio_compression);