From 6ff1b7d20a08e450277693b04fad4a2182ef995b Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 2 May 2020 14:51:00 +0200 Subject: [PATCH] fix reconnection behavior --- htdocs/lib/DemodulatorPanel.js | 10 +++++++++- htdocs/openwebrx.js | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index aa8de15..b5b4bb9 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -97,7 +97,7 @@ DemodulatorPanel.prototype.setMode = function(modulation) { var replace_modulator = current_modulation !== modulation; if (replace_modulator) { - if (this.demodulator) this.demodulator.stop(); + this.stopDemodulator(); this.demodulator = new Demodulator(current_offset_frequency, modulation); var self = this; this.demodulator.on("frequencychange", function(freq) { @@ -144,6 +144,14 @@ DemodulatorPanel.prototype.startDemodulator = function() { this._apply(params); }; +DemodulatorPanel.prototype.stopDemodulator = function() { + if (!this.demodulator) { + return; + } + this.demodulator.stop(); + this.demodulator = false; +} + DemodulatorPanel.prototype._apply = function(params) { this.setMode(params.mod); this.getDemodulator().set_offset_frequency(params.offset_frequency); diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 65f3ab4..8c72612 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1241,6 +1241,7 @@ function onAudioStart(success, apiType){ var reconnect_timeout = false; function on_ws_closed() { + $("#openwebrx-panel-receiver").demodulatorPanel().stopDemodulator(); if (reconnect_timeout) { // max value: roundabout 8 and a half minutes reconnect_timeout = Math.min(reconnect_timeout * 2, 512000);