secondary fft is now complex, better display for digimodes based on FM

This commit is contained in:
Jakob Ketterl 2020-09-17 22:21:49 +02:00
parent 82825fee41
commit 6a6d4a3c9b
2 changed files with 12 additions and 23 deletions

View File

@ -278,9 +278,9 @@ class dsp(object):
chain = ["cat {input_pipe}"] chain = ["cat {input_pipe}"]
if which == "fft": if which == "fft":
chain += [ chain += [
"csdr realpart_cf", "csdr fft_cc {secondary_fft_input_size} {secondary_fft_block_size}",
"csdr fft_fc {secondary_fft_input_size} {secondary_fft_block_size}",
"csdr logpower_cf -70", "csdr logpower_cf -70",
"csdr fft_exchange_sides_ff {secondary_fft_input_size}",
] ]
if self.fft_compression == "adpcm": if self.fft_compression == "adpcm":
chain += ["csdr compress_fft_adpcm_f_u8 {secondary_fft_size}"] chain += ["csdr compress_fft_adpcm_f_u8 {secondary_fft_size}"]
@ -318,9 +318,7 @@ class dsp(object):
self.restart() self.restart()
def secondary_fft_block_size(self): def secondary_fft_block_size(self):
return (self.samp_rate / self.decimation) / ( return (self.samp_rate / self.decimation) / self.fft_fps
self.fft_fps * 2
) # *2 is there because we do FFT on real signal here
def secondary_decimation(self): def secondary_decimation(self):
return 1 # currently unused return 1 # currently unused

View File

@ -1628,8 +1628,8 @@ function secondary_demod_waterfall_add(data) {
} }
function secondary_demod_update_marker() { function secondary_demod_update_marker() {
var width = Math.max((secondary_bw / (if_samp_rate / 2)) * secondary_demod_canvas_width, 5); var width = Math.max((secondary_bw / if_samp_rate) * secondary_demod_canvas_width, 5);
var center_at = (secondary_demod_channel_freq / (if_samp_rate / 2)) * secondary_demod_canvas_width + secondary_demod_canvas_left; var center_at = ((secondary_demod_channel_freq - secondary_demod_low_cut) / if_samp_rate) * secondary_demod_canvas_width;
var left = center_at - width / 2; var left = center_at - width / 2;
$("#openwebrx-digimode-select-channel").width(width).css("left", left + "px") $("#openwebrx-digimode-select-channel").width(width).css("left", left + "px")
} }
@ -1677,26 +1677,17 @@ function secondary_demod_canvas_container_mouseup(evt) {
function secondary_demod_waterfall_set_zoom(low_cut, high_cut) { function secondary_demod_waterfall_set_zoom(low_cut, high_cut) {
if (!secondary_demod_canvases_initialized) return; if (!secondary_demod_canvases_initialized) return;
if (low_cut < 0 && high_cut < 0) {
var hctmp = high_cut;
var lctmp = low_cut;
low_cut = -hctmp;
high_cut = -lctmp;
}
else if (low_cut < 0 && high_cut > 0) {
high_cut = Math.max(Math.abs(high_cut), Math.abs(low_cut));
low_cut = 0;
}
secondary_demod_low_cut = low_cut; secondary_demod_low_cut = low_cut;
secondary_demod_high_cut = high_cut; secondary_demod_high_cut = high_cut;
var shown_bw = high_cut - low_cut; var shown_bw = high_cut - low_cut;
secondary_demod_canvas_width = $(secondary_demod_canvas_container).width() * (if_samp_rate / 2) / shown_bw; secondary_demod_canvas_width = $(secondary_demod_canvas_container).width() * (if_samp_rate) / shown_bw;
secondary_demod_canvas_left = -secondary_demod_canvas_width * (low_cut / (if_samp_rate / 2)); secondary_demod_canvas_left = (-secondary_demod_canvas_width / 2) - (low_cut / if_samp_rate) * secondary_demod_canvas_width;
//console.log("setzoom", secondary_demod_canvas_width, secondary_demod_canvas_left, low_cut, high_cut);
secondary_demod_canvases.map(function (x) { secondary_demod_canvases.map(function (x) {
$(x).css("left", secondary_demod_canvas_left + "px").css("width", secondary_demod_canvas_width + "px"); $(x).css({
}) left: secondary_demod_canvas_left + "px",
; width: secondary_demod_canvas_width + "px"
});
});
secondary_demod_update_channel_freq_from_event(); secondary_demod_update_channel_freq_from_event();
} }