Put number of averages in configuration

This commit is contained in:
Tatu Peltola 2016-06-07 21:51:04 +03:00
parent 0eb1364cf7
commit e9578c620b
3 changed files with 12 additions and 5 deletions

View File

@ -69,7 +69,8 @@ sdrhu_public_listing = False
# ==== DSP/RX settings ====
dsp_plugin="csdr"
fft_fps=9
fft_size=4096
fft_size=16384 # averaging only works on fft_size=16384 for some reason
fft_averages=50
samp_rate = 250000
center_freq = 145525000

View File

@ -270,6 +270,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_compression(cfg.fft_compression)
dsp.set_format_conversion(cfg.format_conversion)
apply_csdr_cfg_to_dsp(dsp)

View File

@ -26,7 +26,7 @@ import os
import code
import signal
import fcntl
fft_averages = 50
class dsp_plugin:
def __init__(self):
@ -51,6 +51,7 @@ class dsp_plugin:
self.csdr_print_bufsizes = False
self.csdr_through = False
self.squelch_level = 0
self.fft_averages = 50
def chain(self,which):
any_chain_base="ncat -v 127.0.0.1 {nc_port} | "
@ -59,7 +60,7 @@ class dsp_plugin:
any_chain_base+=self.format_conversion+(" | " if self.format_conversion!="" else "") ##"csdr flowcontrol {flowcontrol} auto 1.5 10 | "
if which == "fft":
#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 logaveragepower_cf -70 {fft_size} 50 | csdr fft_exchange_sides_ff {fft_size}"
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}"
if self.fft_compression=="adpcm":
return fft_chain_base+" | csdr compress_fft_adpcm_f_u8 {fft_size}"
else:
@ -118,8 +119,12 @@ class dsp_plugin:
#to change this, restart is required
self.fft_fps=fft_fps
def set_fft_averages(self,fft_averages):
#to change this, restart is required
self.fft_averages=fft_averages
def fft_block_size(self):
return self.samp_rate/self.fft_fps/fft_averages
return self.samp_rate/self.fft_fps/self.fft_averages
def set_format_conversion(self,format_conversion):
self.format_conversion=format_conversion
@ -182,7 +187,7 @@ class dsp_plugin:
#run the command
command=command_base.format( bpf_pipe=self.bpf_pipe, shift_pipe=self.shift_pipe, decimation=self.decimation, \
last_decimation=self.last_decimation, fft_size=self.fft_size, fft_block_size=self.fft_block_size(), \
last_decimation=self.last_decimation, fft_size=self.fft_size, fft_block_size=self.fft_block_size(), fft_averages=self.fft_averages, \
bpf_transition_bw=float(self.bpf_transition_bw)/self.if_samp_rate(), ddc_transition_bw=self.ddc_transition_bw(), \
flowcontrol=int(self.samp_rate*2), start_bufsize=self.base_bufsize*self.decimation, nc_port=self.nc_port, \
squelch_pipe=self.squelch_pipe, smeter_pipe=self.smeter_pipe )