This version at least does not hang when selecting BPSK31.

This commit is contained in:
ha7ilm 2017-05-04 23:48:09 +02:00
parent 15a798cf5f
commit 50748ec042
3 changed files with 32 additions and 27 deletions

25
csdr.py
View File

@ -77,8 +77,8 @@ class dsp:
return fft_chain_base 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 | " 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: if self.secondary_demodulator:
chain_begin+="csdr tee {iqtee_pipe} | " chain_begin+="tee {iqtee_pipe} | "
chain_begin+="csdr tee {iqtee2_pipe} | " # chain_begin+="tee {iqtee2_pipe} | " #TODO digimodes
chain_end = "" chain_end = ""
if self.audio_compression=="adpcm": if self.audio_compression=="adpcm":
chain_end = " | csdr encode_ima_adpcm_i16_u8" 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 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): def secondary_chain(self, which):
return "cat {input_pipe}" #TODO digimodes
secondary_chain_base="cat {input_pipe} | " secondary_chain_base="cat {input_pipe} | "
if which == "fft": 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 "") 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": elif which == "bpsk31":
return secondary_chain_base+"""csdr shift_addition_cc {secondary_shift_pipe} | \ 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 bandpass_fir_fft_cc -{secondary_bpf_cutoff} {secondary_bpf_cutoff} {secondary_bpf_transition_bw} HAMMING | " + \
csdr simple_agc_cc 0.0001 0.5 | \ "csdr simple_agc_cc 0.0001 0.5 | " + \
csdr timing_recovery_cc EARLYLATE {secondary_samples_per_bits} --add_q | \ "csdr timing_recovery_cc EARLYLATE {secondary_samples_per_bits} --add_q | " + \
CSDR_FIXED_BUFSIZE=1 csdr realpart_cf | \ "CSDR_FIXED_BUFSIZE=1 csdr realpart_cf | " + \
CSDR_FIXED_BUFSIZE=1 csdr binary_slicer_f_u8 | \ "CSDR_FIXED_BUFSIZE=1 csdr binary_slicer_f_u8 | " + \
CSDR_FIXED_BUFSIZE=1 csdr differential_decoder_u8_u8 | \ "CSDR_FIXED_BUFSIZE=1 csdr differential_decoder_u8_u8 | " + \
CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8 "CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8"
"""
def set_secondary_demodulator(self, what): def set_secondary_demodulator(self, what):
self.secondary_demodulator = 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) pipe_path = getattr(self,pipe_name,None)
if pipe_path: if pipe_path:
try: os.unlink(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): def set_pipe_nonblocking(self, pipe):
flags = fcntl.fcntl(pipe, fcntl.F_GETFL) flags = fcntl.fcntl(pipe, fcntl.F_GETFL)

View File

@ -1165,7 +1165,7 @@ function on_ws_recv(evt)
var waterfall_i16=fft_codec.decode(new Uint8Array(evt.data,4)); var waterfall_i16=fft_codec.decode(new Uint8Array(evt.data,4));
var waterfall_f32=new Float32Array(waterfall_i16.length-COMPRESS_FFT_PAD_N); 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; 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); else waterfall_add_queue(waterfall_f32);
} }
} }

View File

@ -519,13 +519,17 @@ class WebRXHandler(BaseHTTPRequestHandler):
# ========= send secondary ========= # ========= send secondary =========
if do_secondary_demod: if do_secondary_demod:
while True: while True:
try:
secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read()) secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read())
if not secondary_spectrum_data: break if len(secondary_spectrum_data) == 0: break
rxws.send(self, "FFTS", secondary_spectrum_data) rxws.send(self, "FFTS", secondary_spectrum_data)
except: break
while True: while True:
try:
secondary_demod_data=dsp.read_secondary_demod(1) secondary_demod_data=dsp.read_secondary_demod(1)
if not secondary_demod_data: break if len(secondary_demod_data) == 0: break
rxws.send(self, "DAT ", secondary_demod_data) rxws.send(self, "DAT ", secondary_demod_data)
except: break
# ========= process commands ========= # ========= process commands =========
while True: while True:
@ -590,13 +594,15 @@ class WebRXHandler(BaseHTTPRequestHandler):
#code.interact(local=locals()) #code.interact(local=locals())
except: except:
exc_type, exc_value, exc_traceback = sys.exc_info() exc_type, exc_value, exc_traceback = sys.exc_info()
if exc_value[0]==32: #"broken pipe", client disconnected print "[openwebrx-httpd:ws] exception: ",exc_type,exc_value
pass traceback.print_tb(exc_traceback) #TODO digimodes
elif exc_value[0]==11: #"resource unavailable" on recv, client disconnected #if exc_value[0]==32: #"broken pipe", client disconnected
pass # pass
else: #elif exc_value[0]==11: #"resource unavailable" on recv, client disconnected
print "[openwebrx-httpd] error in /ws/ handler: ",exc_type,exc_value # pass
traceback.print_tb(exc_traceback) #else:
# print "[openwebrx-httpd] error in /ws/ handler: ",exc_type,exc_value
# traceback.print_tb(exc_traceback)
#stop dsp for the disconnected client #stop dsp for the disconnected client
try: try: