fix reconnection behavior

This commit is contained in:
Jakob Ketterl 2020-05-02 14:51:00 +02:00
parent 3504c8b54e
commit 6ff1b7d20a
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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);