From c0ca216e4d11c49bdf48ba5712975818852e359b Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 5 Apr 2021 17:18:30 +0200 Subject: [PATCH] make "digimodes_fft_size" work from web config --- csdr/csdr.py | 6 +++++- htdocs/openwebrx.js | 9 ++++++--- owrx/dsp.py | 18 +++++++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/csdr/csdr.py b/csdr/csdr.py index 1b1f361..8915fdc 100644 --- a/csdr/csdr.py +++ b/csdr/csdr.py @@ -490,8 +490,10 @@ class dsp(object): return self.secondary_demodulator def set_secondary_fft_size(self, secondary_fft_size): - # to change this, restart is required + if self.secondary_fft_size == secondary_fft_size: + return self.secondary_fft_size = secondary_fft_size + self.restart() def set_audio_compression(self, what): if self.audio_compression == what: @@ -640,6 +642,8 @@ class dsp(object): return self.demodulator def set_fft_size(self, fft_size): + if self.fft_size == fft_size: + return self.fft_size = fft_size self.restart() diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 07bcf25..92cf973 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -779,9 +779,12 @@ function on_ws_recv(evt) { break; case "secondary_config": var s = json['value']; - window.secondary_fft_size = s['secondary_fft_size']; - window.secondary_bw = s['secondary_bw']; - window.if_samp_rate = s['if_samp_rate']; + if ('secondary_fft_size' in s) + window.secondary_fft_size = s['secondary_fft_size']; + if ('secondary_bw' in s) + window.secondary_bw = s['secondary_bw']; + if ('if_samp_rate' in s) + window.if_samp_rate = s['if_samp_rate']; secondary_demod_init_canvases(); break; case "receiver_details": diff --git a/owrx/dsp.py b/owrx/dsp.py index 647d28c..ec96b70 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -137,21 +137,25 @@ class DspManager(csdr.output, SdrSourceEventClient): if self.props["digimodes_enable"]: + def send_secondary_config(*args): + self.handler.write_secondary_dsp_config( + { + "secondary_fft_size": self.props["digimodes_fft_size"], + "if_samp_rate": self.dsp.if_samp_rate(), + "secondary_bw": self.dsp.secondary_bw(), + } + ) + def set_secondary_mod(mod): if mod == False: mod = None self.dsp.set_secondary_demodulator(mod) if mod is not None: - self.handler.write_secondary_dsp_config( - { - "secondary_fft_size": self.props["digimodes_fft_size"], - "if_samp_rate": self.dsp.if_samp_rate(), - "secondary_bw": self.dsp.secondary_bw(), - } - ) + send_secondary_config() self.subscriptions += [ self.props.wireProperty("secondary_mod", set_secondary_mod), + self.props.wireProperty("digimodes_fft_size", send_secondary_config), self.props.wireProperty("secondary_offset_freq", self.dsp.set_secondary_offset_freq), ]