make "digimodes_fft_size" work from web config

This commit is contained in:
Jakob Ketterl 2021-04-05 17:18:30 +02:00
parent a9990f1f41
commit c0ca216e4d
3 changed files with 22 additions and 11 deletions

View File

@ -490,8 +490,10 @@ class dsp(object):
return self.secondary_demodulator return self.secondary_demodulator
def set_secondary_fft_size(self, secondary_fft_size): 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.secondary_fft_size = secondary_fft_size
self.restart()
def set_audio_compression(self, what): def set_audio_compression(self, what):
if self.audio_compression == what: if self.audio_compression == what:
@ -640,6 +642,8 @@ class dsp(object):
return self.demodulator return self.demodulator
def set_fft_size(self, fft_size): def set_fft_size(self, fft_size):
if self.fft_size == fft_size:
return
self.fft_size = fft_size self.fft_size = fft_size
self.restart() self.restart()

View File

@ -779,8 +779,11 @@ function on_ws_recv(evt) {
break; break;
case "secondary_config": case "secondary_config":
var s = json['value']; var s = json['value'];
if ('secondary_fft_size' in s)
window.secondary_fft_size = s['secondary_fft_size']; window.secondary_fft_size = s['secondary_fft_size'];
if ('secondary_bw' in s)
window.secondary_bw = s['secondary_bw']; window.secondary_bw = s['secondary_bw'];
if ('if_samp_rate' in s)
window.if_samp_rate = s['if_samp_rate']; window.if_samp_rate = s['if_samp_rate'];
secondary_demod_init_canvases(); secondary_demod_init_canvases();
break; break;

View File

@ -137,11 +137,7 @@ class DspManager(csdr.output, SdrSourceEventClient):
if self.props["digimodes_enable"]: if self.props["digimodes_enable"]:
def set_secondary_mod(mod): def send_secondary_config(*args):
if mod == False:
mod = None
self.dsp.set_secondary_demodulator(mod)
if mod is not None:
self.handler.write_secondary_dsp_config( self.handler.write_secondary_dsp_config(
{ {
"secondary_fft_size": self.props["digimodes_fft_size"], "secondary_fft_size": self.props["digimodes_fft_size"],
@ -150,8 +146,16 @@ class DspManager(csdr.output, SdrSourceEventClient):
} }
) )
def set_secondary_mod(mod):
if mod == False:
mod = None
self.dsp.set_secondary_demodulator(mod)
if mod is not None:
send_secondary_config()
self.subscriptions += [ self.subscriptions += [
self.props.wireProperty("secondary_mod", set_secondary_mod), 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), self.props.wireProperty("secondary_offset_freq", self.dsp.set_secondary_offset_freq),
] ]