This version at least does not hang when selecting BPSK31.
This commit is contained in:
parent
15a798cf5f
commit
50748ec042
25
csdr.py
25
csdr.py
@ -77,8 +77,8 @@ class dsp:
|
||||
return fft_chain_base
|
||||
chain_begin=any_chain_base+"csdr shift_addition_cc --fifo {shift_pipe} | csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING | csdr bandpass_fir_fft_cc --fifo {bpf_pipe} {bpf_transition_bw} HAMMING | csdr squelch_and_smeter_cc --fifo {squelch_pipe} --outfifo {smeter_pipe} 5 1 | "
|
||||
if self.secondary_demodulator:
|
||||
chain_begin+="csdr tee {iqtee_pipe} | "
|
||||
chain_begin+="csdr tee {iqtee2_pipe} | "
|
||||
chain_begin+="tee {iqtee_pipe} | "
|
||||
# chain_begin+="tee {iqtee2_pipe} | " #TODO digimodes
|
||||
chain_end = ""
|
||||
if self.audio_compression=="adpcm":
|
||||
chain_end = " | csdr encode_ima_adpcm_i16_u8"
|
||||
@ -87,20 +87,19 @@ class dsp:
|
||||
elif which == "ssb": return chain_begin + "csdr realpart_cf | csdr old_fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
|
||||
|
||||
def secondary_chain(self, which):
|
||||
return "cat {input_pipe}" #TODO digimodes
|
||||
secondary_chain_base="cat {input_pipe} | "
|
||||
|
||||
if which == "fft":
|
||||
return secondary_chain_base+"csdr realpart_cf | csdr fft_fc {secondary_fft_size} {secondary_fft_block_size} | csdr logpower_cf -70 | csdr fft_one_side_ff {secondary_fft_size}" + (" | 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} | \
|
||||
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 | \
|
||||
CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8
|
||||
"""
|
||||
return secondary_chain_base + "csdr shift_addition_cc {secondary_shift_pipe} | " + \
|
||||
"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 | " + \
|
||||
"CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8"
|
||||
|
||||
def set_secondary_demodulator(self, what):
|
||||
self.secondary_demodulator = what
|
||||
@ -302,7 +301,7 @@ CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8
|
||||
pipe_path = getattr(self,pipe_name,None)
|
||||
if pipe_path:
|
||||
try: os.unlink(pipe_path)
|
||||
except: print "[openwebrx-dsp-plugin:csdr] try_delete_pipes() :: unlink failed: " + pipe_path
|
||||
except Exception as e: print "[openwebrx-dsp-plugin:csdr] try_delete_pipes() ::", e
|
||||
|
||||
def set_pipe_nonblocking(self, pipe):
|
||||
flags = fcntl.fcntl(pipe, fcntl.F_GETFL)
|
||||
|
@ -1165,7 +1165,7 @@ 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<waterfall_i16.length;i++) waterfall_f32[i]=waterfall_i16[i+COMPRESS_FFT_PAD_N]/100;
|
||||
if(evt.data[3]=="S") secondary_demod_waterfall_add_queue(waterfall_f32), console.log("FFTS");
|
||||
if(evt.data[3]=="S") { secondary_demod_waterfall_add_queue(waterfall_f32); console.log("FFTS"); }
|
||||
else waterfall_add_queue(waterfall_f32);
|
||||
}
|
||||
}
|
||||
|
32
openwebrx.py
32
openwebrx.py
@ -519,13 +519,17 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
||||
# ========= send secondary =========
|
||||
if do_secondary_demod:
|
||||
while True:
|
||||
secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read())
|
||||
if not secondary_spectrum_data: break
|
||||
rxws.send(self, "FFTS", secondary_spectrum_data)
|
||||
try:
|
||||
secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read())
|
||||
if len(secondary_spectrum_data) == 0: break
|
||||
rxws.send(self, "FFTS", secondary_spectrum_data)
|
||||
except: break
|
||||
while True:
|
||||
secondary_demod_data=dsp.read_secondary_demod(1)
|
||||
if not secondary_demod_data: break
|
||||
rxws.send(self, "DAT ", secondary_demod_data)
|
||||
try:
|
||||
secondary_demod_data=dsp.read_secondary_demod(1)
|
||||
if len(secondary_demod_data) == 0: break
|
||||
rxws.send(self, "DAT ", secondary_demod_data)
|
||||
except: break
|
||||
|
||||
# ========= process commands =========
|
||||
while True:
|
||||
@ -590,13 +594,15 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
||||
#code.interact(local=locals())
|
||||
except:
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
if exc_value[0]==32: #"broken pipe", client disconnected
|
||||
pass
|
||||
elif exc_value[0]==11: #"resource unavailable" on recv, client disconnected
|
||||
pass
|
||||
else:
|
||||
print "[openwebrx-httpd] error in /ws/ handler: ",exc_type,exc_value
|
||||
traceback.print_tb(exc_traceback)
|
||||
print "[openwebrx-httpd:ws] exception: ",exc_type,exc_value
|
||||
traceback.print_tb(exc_traceback) #TODO digimodes
|
||||
#if exc_value[0]==32: #"broken pipe", client disconnected
|
||||
# pass
|
||||
#elif exc_value[0]==11: #"resource unavailable" on recv, client disconnected
|
||||
# pass
|
||||
#else:
|
||||
# print "[openwebrx-httpd] error in /ws/ handler: ",exc_type,exc_value
|
||||
# traceback.print_tb(exc_traceback)
|
||||
|
||||
#stop dsp for the disconnected client
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user