From 28c1425a8fce82cccd29b873508532b4f8e637ce Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 2 May 2020 02:13:16 +0200 Subject: [PATCH] fix digimode init from hash --- htdocs/lib/Demodulator.js | 2 -- htdocs/lib/DemodulatorPanel.js | 11 ++++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/lib/Demodulator.js b/htdocs/lib/Demodulator.js index b43dfcb..c268c48 100644 --- a/htdocs/lib/Demodulator.js +++ b/htdocs/lib/Demodulator.js @@ -237,8 +237,6 @@ Demodulator.prototype.set_offset_frequency = function(to_what) { this.set(); this.emit("frequencychange", to_what); mkenvelopes(get_visible_freq_range()); - //tunedFrequencyDisplay.setFrequency(center_freq + to_what); - updateHash(); }; Demodulator.prototype.get_offset_frequency = function() { diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index c8d9fc4..a3a6ca8 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -102,6 +102,7 @@ DemodulatorPanel.prototype.setMode = function(modulation) { var self = this; this.demodulator.on("frequencychange", function(freq) { self.tuneableFrequencyDisplay.setFrequency(center_freq + freq); + updateHash(); }); } if (mode.type === 'digimode') { @@ -139,7 +140,7 @@ DemodulatorPanel.prototype.getDemodulator = function() { }; DemodulatorPanel.prototype.startDemodulator = function() { - var params = $.extend(this.initialParams || {}, validateHash()); + var params = $.extend(this.initialParams || {}, this.transformHashParams(validateHash())); this._apply(params); }; @@ -154,10 +155,14 @@ DemodulatorPanel.prototype.setInitialParams = function(params) { }; DemodulatorPanel.prototype.setHashParams = function(params) { - this._apply({ + this._apply(this.transformHashParams(params)); +}; + +DemodulatorPanel.prototype.transformHashParams = function(params) { + return { mod: params.secondary_mod || params.mod, offset_frequency: params.offset_frequency - }); + }; }; DemodulatorPanel.prototype.updateButtons = function() {