diff --git a/nanovna.h b/nanovna.h index 3c746d6..7eb7507 100644 --- a/nanovna.h +++ b/nanovna.h @@ -88,6 +88,7 @@ #define DB_PER_DEGREE_ABOVE 0.069 #define CENTER_TEMPERATURE 34.0 #define __WAIT_CTS_WHILE_SLEEPING__ +//#define __FFT_VBW__ //#define __FFT_DECONV__ #else #endif diff --git a/sa_core.c b/sa_core.c index 35dcb99..2263d96 100644 --- a/sa_core.c +++ b/sa_core.c @@ -35,6 +35,12 @@ float *real2 = (float *) &spi_buffer[1024]; float *imag2 = (float *) &spi_buffer[1536]; #endif +#ifdef __FFT_VBW__ +void FFT(float *real, float *imag, int length, bool inverse); +float *real = (float *) &spi_buffer[0]; +float *imag = (float *) &spi_buffer[512]; +#endif + //#define __DEBUG_AGC__ If set the AGC value will be shown in the stored trace and FAST_SWEEP rmmode will be disabled #ifdef __DEBUG_AGC__ #ifdef __FAST_SWEEP__ @@ -3813,6 +3819,36 @@ static bool sweep(bool break_on_operation) #ifdef __VBW__ +#ifdef __FFT_VBW__ + if (setting.vbw_x10 != 0 && sweep_points == 256) { + float m = 150; + for (int i=0;i temp_t[i]) + m = temp_t[i]; + real[i] = 0; + imag[i] = 0; + actual_t[i] = -150; + } + for (int i=0;i temp_t[i]) m = temp_t[i]; - real[i] = 0; + real[i] = 0.000000000001; imag[i] = 0; - real2[0] = 0; + real2[0] = 0.000000000001; imag2[i] = 0; actual_t[i] = -150; } - for (int i=0;i m+25) + real[i] = temp_t[i] - m; } - FFT(real, imag, 256, false); +#if 1 #if 0 for (int i = 128 - d_width*2; i<128+d_width*2; i++) { real[i] = 0; imag[i] = 0; } #endif -#if 0 +#if 1 for (int i=0;i