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,9 +779,12 @@ function on_ws_recv(evt) {
break; break;
case "secondary_config": case "secondary_config":
var s = json['value']; var s = json['value'];
window.secondary_fft_size = s['secondary_fft_size']; if ('secondary_fft_size' in s)
window.secondary_bw = s['secondary_bw']; window.secondary_fft_size = s['secondary_fft_size'];
window.if_samp_rate = s['if_samp_rate']; 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(); secondary_demod_init_canvases();
break; break;
case "receiver_details": case "receiver_details":

View File

@ -137,21 +137,25 @@ class DspManager(csdr.output, SdrSourceEventClient):
if self.props["digimodes_enable"]: 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): def set_secondary_mod(mod):
if mod == False: if mod == False:
mod = None mod = None
self.dsp.set_secondary_demodulator(mod) self.dsp.set_secondary_demodulator(mod)
if mod is not None: if mod is not None:
self.handler.write_secondary_dsp_config( send_secondary_config()
{
"secondary_fft_size": self.props["digimodes_fft_size"],
"if_samp_rate": self.dsp.if_samp_rate(),
"secondary_bw": self.dsp.secondary_bw(),
}
)
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),
] ]