diff --git a/csdr.py b/csdr.py index 9d02ea7..2e325ab 100755 --- a/csdr.py +++ b/csdr.py @@ -78,7 +78,7 @@ class dsp: 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+="tee {iqtee_pipe} | " - # chain_begin+="tee {iqtee2_pipe} | " #TODO digimodes + # chain_begin+="tee {iqtee2_pipe} | " #TODO digimodes, and yes, tee sometimes hangs everything chain_end = "" if self.audio_compression=="adpcm": chain_end = " | csdr encode_ima_adpcm_i16_u8" @@ -87,7 +87,6 @@ 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 "") @@ -154,16 +153,16 @@ class dsp: if self.csdr_print_bufsizes: my_env["CSDR_PRINT_BUFSIZES"]="1"; self.secondary_process_fft = subprocess.Popen(secondary_command_fft, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env) print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (fft)" - self.secondary_process_demod = subprocess.Popen(secondary_command_demod, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env) - print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (demod)" + # self.secondary_process_demod = subprocess.Popen(secondary_command_demod, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env) #TODO digimodes + # print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (demod)" #TODO digimodes self.secondary_processes_running = True #open control pipes for csdr and send initialization data - if self.secondary_shift_pipe != None: - self.secondary_shift_pipe_file=open(self.secondary_shift_pipe,"w") - self.set_secondary_offset_freq(self.secondary_offset_freq) + # 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 - self.set_pipe_nonblocking(self.secondary_process_demod.stdout) + # self.set_pipe_nonblocking(self.secondary_process_demod.stdout) #TODO digimodes self.set_pipe_nonblocking(self.secondary_process_fft.stdout) def set_secondary_offset_freq(self, value): diff --git a/openwebrx.py b/openwebrx.py index 3762ff6..66419a7 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -469,13 +469,11 @@ class WebRXHandler(BaseHTTPRequestHandler): dsp.nc_port=cfg.iq_server_port apply_csdr_cfg_to_dsp(dsp) myclient.dsp=dsp - + do_secondary_demod=False access_log("Started streaming to client: "+self.client_address[0]+"#"+myclient.id+" (users now: "+str(len(clients))+")") - myclient.loopstat=0 - do_secondary_demod=False - while True: + myclient.loopstat=0 if myclient.closed[0]: print "[openwebrx-httpd:ws] client closed by other thread" break @@ -518,6 +516,7 @@ class WebRXHandler(BaseHTTPRequestHandler): # ========= send secondary ========= if do_secondary_demod: + myclient.loopstat=41 while True: try: secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read()) @@ -525,6 +524,7 @@ class WebRXHandler(BaseHTTPRequestHandler): print "len(secondary_spectrum_data)", len(secondary_spectrum_data) #TODO digimodes rxws.send(self, secondary_spectrum_data, "FFTS") except: break + myclient.loopstat=42 while True: try: secondary_demod_data=dsp.read_secondary_demod(1) @@ -536,8 +536,9 @@ class WebRXHandler(BaseHTTPRequestHandler): while True: myclient.loopstat=50 rdata=rxws.recv(self, False) - if not rdata: break + myclient.loopstat=51 #try: + if not rdata: break elif rdata[:3]=="SET": print "[openwebrx-httpd:ws,%d] command: %s"%(client_i,rdata) pairs=rdata[4:].split(" ") @@ -594,6 +595,7 @@ class WebRXHandler(BaseHTTPRequestHandler): dsp.set_bpf(*new_bpf) #code.interact(local=locals()) except: + myclient.loopstat=990 exc_type, exc_value, exc_traceback = sys.exc_info() print "[openwebrx-httpd:ws] exception: ",exc_type,exc_value traceback.print_tb(exc_traceback) #TODO digimodes @@ -606,6 +608,7 @@ class WebRXHandler(BaseHTTPRequestHandler): # traceback.print_tb(exc_traceback) #stop dsp for the disconnected client + myclient.loopstat=991 try: dsp.stop() del dsp @@ -613,6 +616,7 @@ class WebRXHandler(BaseHTTPRequestHandler): print "[openwebrx-httpd] error in dsp.stop()" #delete disconnected client + myclient.loopstat=992 try: cma("do_GET /ws/ delete disconnected") id_to_close=get_client_by_id(myclient.id,False)