Moved fft_averages calculation to openwebrx.py. Renamed fft_overlap to fft_voverlap_factor because it is not related to overlapped FFT. It is rather related to the vertical overlap of the amplitudes (calculated from FFT bins) on the display.

This commit is contained in:
ha7ilm 2016-10-29 21:22:31 +02:00
parent 816f860de3
commit a31d4b9fe2
3 changed files with 8 additions and 12 deletions

View File

@ -70,11 +70,8 @@ sdrhu_public_listing = False
dsp_plugin="csdr"
fft_fps=9
fft_size=4096
fft_overlap=0.3
fft_voverlap_factor=0.3
samp_rate = 250000
fft_averages=int(round(1.0 * samp_rate / fft_size / fft_fps / (1.0 - fft_overlap)))
center_freq = 145525000
rf_gain = 5 #in dB. For an RTL-SDR, rf_gain=0 will set the tuner to auto gain mode, else it will be in manual gain mode.
ppm = 0

View File

@ -287,7 +287,7 @@ def spectrum_thread_function():
dsp.set_samp_rate(cfg.samp_rate)
dsp.set_fft_size(cfg.fft_size)
dsp.set_fft_fps(cfg.fft_fps)
dsp.set_fft_averages(cfg.fft_averages)
dsp.set_fft_averages(int(round(1.0 * cfg.samp_rate / cfg.fft_size / cfg.fft_fps / (1.0 - cfg.fft_voverlap_factor))) if cfg.fft_voverlap_factor>0 else 0)
dsp.set_fft_compression(cfg.fft_compression)
dsp.set_format_conversion(cfg.format_conversion)
apply_csdr_cfg_to_dsp(dsp)
@ -493,7 +493,7 @@ class WebRXHandler(BaseHTTPRequestHandler):
if smeter_level == None: break
except:
break
if smeter_level!=None:
if smeter_level!=None:
myclient.loopstat=31
rxws.send(self, "MSG s={0}".format(smeter_level))

View File

@ -59,11 +59,9 @@ class dsp_plugin:
if self.csdr_through: any_chain_base+="csdr through | "
any_chain_base+=self.format_conversion+(" | " if self.format_conversion!="" else "") ##"csdr flowcontrol {flowcontrol} auto 1.5 10 | "
if which == "fft":
if self.fft_averages > 1:
fft_chain_base = any_chain_base+"csdr fft_cc {fft_size} {fft_block_size} | csdr logaveragepower_cf -70 {fft_size} {fft_averages} | csdr fft_exchange_sides_ff {fft_size}"
else:
fft_chain_base = any_chain_base+"csdr fft_cc {fft_size} {fft_block_size} | csdr logpower_cf -70 | csdr fft_exchange_sides_ff {fft_size}"
fft_chain_base = any_chain_base+"csdr fft_cc {fft_size} {fft_block_size} | " + \
("csdr logpower_cf -70 | " if self.fft_averages == 0 else "csdr logaveragepower_cf -70 {fft_size} {fft_averages} | ") + \
"csdr fft_exchange_sides_ff {fft_size}"
if self.fft_compression=="adpcm":
return fft_chain_base+" | csdr compress_fft_adpcm_f_u8 {fft_size}"
else:
@ -127,7 +125,8 @@ class dsp_plugin:
self.fft_averages=fft_averages
def fft_block_size(self):
return self.samp_rate/self.fft_fps/self.fft_averages
if self.fft_averages == 0: return self.samp_rate/self.fft_fps
else: return self.samp_rate/self.fft_fps/self.fft_averages
def set_format_conversion(self,format_conversion):
self.format_conversion=format_conversion