From a4313c334070eb50b54020f8889b585e2cef394c Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 5 May 2019 20:36:50 +0200 Subject: [PATCH] add secondary demod (not working with my csdr atm, unable to test.) --- htdocs/openwebrx.js | 12 ++++++------ owrx/source.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 1694c30..be3a143 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -2628,19 +2628,19 @@ function secondary_demod_init() function secondary_demod_start(subtype) { secondary_demod_canvases_initialized = false; - ws.send("SET secondary_mod="+subtype); - secondary_demod = subtype; + ws.send(JSON.stringify({"type":"dspcontrol","params":{"secondary_mod":subtype}})); + secondary_demod = subtype; } function secondary_demod_set() { - ws.send("SET secondary_offset_freq="+secondary_demod_offset_freq.toString()); + ws.send(JSON.stringify({"type":"dspcontrol","params":{"secondary_offset_freq":secondary_demod_offset_freq}})); } function secondary_demod_stop() { - ws.send("SET secondary_mod=off"); - secondary_demod = false; + ws.send(JSON.stringify({"type":"dspcontrol","params":{"secondary_mod":false}})); + secondary_demod = false; secondary_demod_waterfall_queue = []; } @@ -2767,7 +2767,7 @@ function secondary_demod_update_channel_freq_from_event(evt) { secondary_demod_waiting_for_set = true; window.setTimeout(()=>{ - ws.send("SET secondary_offset_freq="+Math.floor(secondary_demod_channel_freq)); + ws.send(JSON.stringify({"type":"dspcontrol","params":{"secondary_offset_freq":Math.floor(secondary_demod_channel_freq)}})); //console.log("doneset:", secondary_demod_channel_freq); secondary_demod_waiting_for_set = false; }, 50); diff --git a/owrx/source.py b/owrx/source.py index 551fcc3..12ac470 100644 --- a/owrx/source.py +++ b/owrx/source.py @@ -136,6 +136,21 @@ class DspManager(object): self.dsp.start() self.localProps.getProperty("mod").wire(set_mod) + if (pm.getPropertyValue("digimodes_enable")): + def set_secondary_mod(mod): + self.dsp.stop() + if mod == False: + self.dsp.set_secondary_demodulator(None) + else: + self.dsp.set_secondary_demodulator(mod) + # TODO frontend will probably miss this + #rxws.send(self, "MSG secondary_fft_size={0} if_samp_rate={1} secondary_bw={2} secondary_setup".format(cfg.digimodes_fft_size, dsp.if_samp_rate(), dsp.secondary_bw())) + self.dsp.start() + + self.localProps.getProperty("secondary_mod").wire(set_secondary_mod) + + self.localProps.getProperty("secondary_offset_freq").wire(self.dsp.set_secondary_offset_freq) + super().__init__() def start(self):