Full demod chain looks working (but does not decode)

This commit is contained in:
ha7ilm 2017-05-07 18:12:43 +02:00
parent 33f5f57524
commit 8e2fdd473b
3 changed files with 45 additions and 14 deletions

15
csdr.py
View File

@ -61,6 +61,7 @@ class dsp:
self.secondary_process_demod = None
self.pipe_names=["bpf_pipe", "shift_pipe", "squelch_pipe", "smeter_pipe", "iqtee_pipe", "iqtee2_pipe"]
self.secondary_pipe_names=["secondary_shift_pipe"]
self.secondary_offset_freq = 1000
def chain(self,which):
any_chain_base="nc -v 127.0.0.1 {nc_port} | "
@ -91,14 +92,14 @@ class dsp:
if which == "fft":
return secondary_chain_base+"csdr realpart_cf | csdr fft_fc {secondary_fft_input_size} {secondary_fft_block_size} | csdr logpower_cf -70 " + (" | csdr compress_fft_adpcm_f_u8 {secondary_fft_size}" if self.fft_compression=="adpcm" else "")
elif which == "bpsk31":
return secondary_chain_base + ("csdr shift_addition_cc {secondary_shift_pipe} | " if 0 else "") + \
return secondary_chain_base + ("csdr shift_addition_cc --fifo {secondary_shift_pipe} | " if 1 else "") + \
"csdr bandpass_fir_fft_cc -{secondary_bpf_cutoff} {secondary_bpf_cutoff} {secondary_bpf_transition_bw} HAMMING | " + \
"csdr simple_agc_cc 0.0001 0.5 | " + \
"csdr timing_recovery_cc EARLYLATE {secondary_samples_per_bits} --add_q | " + \
"CSDR_FIXED_BUFSIZE=1 csdr realpart_cf | " + \
"CSDR_FIXED_BUFSIZE=1 csdr binary_slicer_f_u8 | " + \
"CSDR_FIXED_BUFSIZE=1 csdr differential_decoder_u8_u8 | " + \
"cat"
"CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8"
#TODO digimodes:
"""
return secondary_chain_base + "csdr shift_addition_cc {secondary_shift_pipe} | " + \
@ -174,9 +175,13 @@ class dsp:
self.secondary_processes_running = True
#open control pipes for csdr and send initialization data
# if self.secondary_shift_pipe != None: #TODO digimodes
# self.secondary_shift_pipe_file=open(self.secondary_shift_pipe,"w") #TODO digimodes
# self.set_secondary_offset_freq(self.secondary_offset_freq) #TODO digimodes
print "==========> 1"
if self.secondary_shift_pipe != None: #TODO digimodes
print "==========> 2", self.secondary_shift_pipe
self.secondary_shift_pipe_file=open(self.secondary_shift_pipe,"w") #TODO digimodes
print "==========> 3"
self.set_secondary_offset_freq(self.secondary_offset_freq) #TODO digimodes
print "==========> 4"
self.set_pipe_nonblocking(self.secondary_process_demod.stdout)
self.set_pipe_nonblocking(self.secondary_process_fft.stdout)

View File

@ -958,5 +958,8 @@ img.openwebrx-mirror-img
top: 0px;
left: 0px;
opacity: 0.7;
border-style: solid;
border-width: 0px;
border-color: Red;
}

View File

@ -1174,7 +1174,8 @@ function on_ws_recv(evt)
}
else if(first3Chars=="DAT")
{
secondary_demod_push_binary_data(new Uint8Array(evt.data,4))
//secondary_demod_push_binary_data(new Uint8Array(evt.data,4));
secondary_demod_push_data(arrayBufferToString(evt.data).substring(4));
//console.log("DAT");
}
else if(first3Chars=="MSG")
@ -2269,7 +2270,7 @@ function secondary_demod_init_canvases()
secondary_demod_current_canvas_actual_line=$(secondary_demod_canvas_container).height()-1;
secondary_demod_current_canvas_index=0;
secondary_demod_canvases_initialized=true;
secondary_demod_update_marker();
secondary_demod_update_channel_freq_from_event();
}
function secondary_demod_canvases_update_top()
@ -2329,6 +2330,15 @@ function secondary_demod_push_binary_data(x)
function secondary_demod_push_data(x)
{
x=Array.from(x).map((y)=>{
var c=y.charCodeAt(0);
if(c<32||c>126) return "";
if(y=="\n") return "<br />";
if(y=="&") return "&amp;";
if(y=="<") return "&lt;";
if(y==">") return "&gt;";
return y;
}).join("");
$("#openwebrx-cursor-blink").before("<span class=\"part\"><span class=\"subpart\">"+x+"</span></span>");
}
@ -2407,25 +2417,38 @@ function secondary_demod_listbox_update()
secondary_demod_channel_freq=1000;
function secondary_demod_update_marker()
{
var width = Math.max( (secondary_bw / if_samp_rate) * $(secondary_demod_canvas_container).width(), 5);
var center_at = (secondary_demod_channel_freq / if_samp_rate) * $(secondary_demod_canvas_container).width();
var width = Math.max( (secondary_bw / (if_samp_rate/2)) * $(secondary_demod_canvas_container).width(), 5);
var center_at = (secondary_demod_channel_freq / (if_samp_rate/2)) * $(secondary_demod_canvas_container).width();
var left = center_at-width / 2;
console.log("sdum", width, left);
//console.log("sdum", width, left);
$("#openwebrx-digimode-select-channel").width(width).css("left",left+"px")
}
secondary_demod_waiting_for_set = false;
function secondary_demod_update_channel_freq_from_event(evt)
{
var relativeX=(evt.offsetX)?evt.offsetX:evt.layerX;
//console.log("ize", evt, e);
secondary_demod_channel_freq=(relativeX/$(secondary_demod_canvas_container).width()) * if_samp_rate;
if(typeof evt !== "undefined")
{
var relativeX=(evt.offsetX)?evt.offsetX:evt.layerX;
secondary_demod_channel_freq=(relativeX/$(secondary_demod_canvas_container).width()) * (if_samp_rate/2);
}
//console.log("toset:", secondary_demod_channel_freq);
if(!secondary_demod_waiting_for_set)
{
secondary_demod_waiting_for_set = true;
window.setTimeout(()=>{
ws.send("SET secondary_offset_freq="+Math.floor(secondary_demod_channel_freq));
//console.log("doneset:", secondary_demod_channel_freq);
secondary_demod_waiting_for_set = false;
}, 50);
}
secondary_demod_update_marker();
}
secondary_demod_mousedown=false;
function secondary_demod_canvas_container_mousein()
{
$("#openwebrx-digimode-select-channel").css("opacity","0.7");
$("#openwebrx-digimode-select-channel").css("opacity","0.7"); //.css("border-width", "1px");
}
function secondary_demod_canvas_container_mouseout()