diff --git a/config_webrx.py b/config_webrx.py index 8d7f1e8..6da6703 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -79,7 +79,8 @@ ppm = 0 audio_compression="adpcm" #valid values: "adpcm", "none" fft_compression="adpcm" #valid values: "adpcm", "none" -enable_digimodes=True #If set to True, it will take more CPU per client +digimodes_enable=True #Decoding digimodes come with higher CPU usage. +digimodes_fft_size=1024 start_rtl_thread=True diff --git a/csdr.py b/csdr.py index 5293d47..be70ff8 100755 --- a/csdr.py +++ b/csdr.py @@ -198,6 +198,10 @@ class dsp: def get_secondary_demodulator(self): return self.secondary_demodulator + def set_secondary_fft_size(self,secondary_fft_size): + #to change this, restart is required + self.secondary_fft_size=secondary_fft_size + def set_audio_compression(self,what): self.audio_compression = what diff --git a/htdocs/index.wrx b/htdocs/index.wrx index 1d92b38..95faf90 100644 --- a/htdocs/index.wrx +++ b/htdocs/index.wrx @@ -34,7 +34,7 @@ var waterfall_min_level_default=%[WATERFALL_MIN_LEVEL]; var waterfall_max_level_default=%[WATERFALL_MAX_LEVEL]; var waterfall_auto_level_margin=%[WATERFALL_AUTO_LEVEL_MARGIN]; - var server_enable_digimodes=%[ENABLE_DIGIMODES]; + var server_enable_digimodes=%[DIGIMODES_ENABLE]; diff --git a/htdocs/openwebrx.css b/htdocs/openwebrx.css index 17d1a35..e0d6c3f 100644 --- a/htdocs/openwebrx.css +++ b/htdocs/openwebrx.css @@ -823,6 +823,13 @@ img.openwebrx-mirror-img border-radius: 15px; height: 150px; background-color: #333; + position: relative; + overflow: hidden; +} + +#openwebrx-digimode-canvas-container canvas +{ + position: absolute; } #openwebrx-secondary-demod-listbox @@ -911,6 +918,7 @@ img.openwebrx-mirror-img { perspective: 700px; } + #openwebrx-digimode-content .part { animation: new-digimode-data-3d 100ms; diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 13502fa..13c3866 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -51,6 +51,7 @@ var audio_compression="none"; var waterfall_setup_done=0; var waterfall_queue = []; var waterfall_timer; +var secondary_fft_size; /*function fade(something,from,to,time_ms,fps) { @@ -1158,7 +1159,7 @@ function on_ws_recv(evt) else if(first3Chars=="FFT") { //alert("Yupee! Doing FFT"); - if(first4Chars=="FFTS") console.log("FFTS"); + //if(first4Chars=="FFTS") console.log("FFTS"); if(fft_compression=="none") waterfall_add_queue(new Float32Array(evt.data,4)); else if(fft_compression="adpcm") { @@ -1167,14 +1168,14 @@ function on_ws_recv(evt) var waterfall_i16=fft_codec.decode(new Uint8Array(evt.data,4)); var waterfall_f32=new Float32Array(waterfall_i16.length-COMPRESS_FFT_PAD_N); for(var i=0;i>>0)>>((3-i)*8))&0xff; + } + + //Draw image + console.log(oneline_image); + secondary_demod_current_canvas_context.putImageData(oneline_image, 0, secondary_demod_current_canvas_actual_line--); + secondary_demod_canvases.map((x)=>{x.openwebrx_top += 1;}); + secondary_demod_canvases_update_top(); + if(secondary_demod_current_canvas_actual_line<0) secondary_demod_swap_canvases(); } +var secondary_demod_canvases_initialized = false; + function secondary_demod_waterfall_dequeue() { - if(!secondary_demod) return; - if(secondary_demod_waterfall_queue.length) secondary_demod_waterfall_add(waterfall_queue.shift()); + if(!secondary_demod || !secondary_demod_canvases_initialized) return; + if(secondary_demod_waterfall_queue.length) secondary_demod_waterfall_add(secondary_demod_waterfall_queue.shift()); if(secondary_demod_waterfall_queue.length>Math.max(fft_fps/2,20)) //in case of fft overflow { console.log("secondary waterfall overflow, queue length:", secondary_demod_waterfall_queue.length); diff --git a/openwebrx.py b/openwebrx.py index b6062d7..36a6e75 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -466,6 +466,7 @@ class WebRXHandler(BaseHTTPRequestHandler): dsp.set_format_conversion(cfg.format_conversion) dsp.set_offset_freq(0) dsp.set_bpf(-4000,4000) + dsp.set_secondary_fft_size(cfg.digimodes_fft_size) dsp.nc_port=cfg.iq_server_port apply_csdr_cfg_to_dsp(dsp) myclient.dsp=dsp @@ -531,7 +532,7 @@ class WebRXHandler(BaseHTTPRequestHandler): secondary_demod_data=dsp.read_secondary_demod(1) myclient.loopstat=423 if len(secondary_demod_data) == 0: break - print "len(secondary_demod_data)", len(secondary_demod_data), secondary_demod_data #TODO digimodes + # print "len(secondary_demod_data)", len(secondary_demod_data), secondary_demod_data #TODO digimodes rxws.send(self, secondary_demod_data, "DAT ") except: break @@ -579,7 +580,7 @@ class WebRXHandler(BaseHTTPRequestHandler): myclient.loopstat=550 dsp.start() dsp_initialized=True - elif param_name=="secondary_mod" and cfg.enable_digimodes: + elif param_name=="secondary_mod" and cfg.digimodes_enable: if (dsp.get_secondary_demodulator() != param_value): if dsp_initialized: dsp.stop() if param_value == "off": @@ -588,8 +589,9 @@ class WebRXHandler(BaseHTTPRequestHandler): else: dsp.set_secondary_demodulator(param_value) do_secondary_demod = True + rxws.send(self, "MSG secondary_fft_size={0} secondary_setup".format(cfg.digimodes_fft_size)) if dsp_initialized: dsp.start() - elif param_name=="secondary_offset_freq" and 0 <= int(param_value) <= dsp.if_samp_rate()/2 and cfg.enable_digimodes: + elif param_name=="secondary_offset_freq" and 0 <= int(param_value) <= dsp.if_samp_rate()/2 and cfg.digimodes_enable: dsp.set_secondary_offset_freq(int(param_value)) else: print "[openwebrx-httpd:ws] invalid parameter" @@ -684,7 +686,7 @@ class WebRXHandler(BaseHTTPRequestHandler): ("%[WATERFALL_MIN_LEVEL]",str(cfg.waterfall_min_level)), ("%[WATERFALL_MAX_LEVEL]",str(cfg.waterfall_max_level)), ("%[WATERFALL_AUTO_LEVEL_MARGIN]","[%d,%d]"%cfg.waterfall_auto_level_margin), - ("%[ENABLE_DIGIMODES]",("true" if cfg.enable_digimodes else "false")) + ("%[DIGIMODES_ENABLE]",("true" if cfg.digimodes_enable else "false")) ) for rule in replace_dictionary: while data.find(rule[0])!=-1: