From e5196c6af94aca40bab7e6740b4896f67cb026dc Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 2 May 2020 01:35:38 +0200 Subject: [PATCH] prevent starting demodulator if already started --- htdocs/lib/DemodulatorPanel.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/lib/DemodulatorPanel.js b/htdocs/lib/DemodulatorPanel.js index 8d37085..c8d9fc4 100644 --- a/htdocs/lib/DemodulatorPanel.js +++ b/htdocs/lib/DemodulatorPanel.js @@ -95,7 +95,8 @@ DemodulatorPanel.prototype.setMode = function(modulation) { current_offset_frequency = this.demodulator.get_offset_frequency(); } - if (current_modulation !== modulation) { + var replace_modulator = current_modulation !== modulation; + if (replace_modulator) { if (this.demodulator) this.demodulator.stop(); this.demodulator = new Demodulator(current_offset_frequency, modulation); var self = this; @@ -108,7 +109,10 @@ DemodulatorPanel.prototype.setMode = function(modulation) { } else { this.demodulator.set_secondary_demod(false); } - this.demodulator.start(); + + if (replace_modulator) { + this.demodulator.start(); + } this.updateButtons(); this.updatePanels();