initialize frequeny correctly

This commit is contained in:
Jakob Ketterl 2020-05-03 21:26:11 +02:00
parent beed0c1a70
commit 8e313517d1

View File

@ -113,11 +113,13 @@ DemodulatorPanel.prototype.setMode = function(modulation) {
this.demodulator = new Demodulator(current.offset_frequency, modulation); this.demodulator = new Demodulator(current.offset_frequency, modulation);
this.demodulator.setSquelch(current.squelch_level); this.demodulator.setSquelch(current.squelch_level);
var self = this; var self = this;
this.demodulator.on("frequencychange", function(freq) { var updateFrequency = function(freq) {
self.tuneableFrequencyDisplay.setFrequency(self.center_freq + freq); self.tuneableFrequencyDisplay.setFrequency(self.center_freq + freq);
self.updateHash(); self.updateHash();
}); };
updateSquelch = function(squelch) { this.demodulator.on("frequencychange", updateFrequency);
updateFrequency(this.demodulator.get_offset_frequency());
var updateSquelch = function(squelch) {
self.el.find('.openwebrx-squelch-slider').val(squelch); self.el.find('.openwebrx-squelch-slider').val(squelch);
self.updateHash(); self.updateHash();
}; };