Merge branch 'DiSlord_tinySA-V4-SI4463' of https://github.com/erikkaashoek/tinySA into DiSlord_tinySA-V4-SI4463

# Conflicts:
#	sa_core.c
multi_trace
DiSlord 5 years ago
commit 49f80acd70

@ -88,6 +88,7 @@
#define DB_PER_DEGREE_ABOVE 0.069 #define DB_PER_DEGREE_ABOVE 0.069
#define CENTER_TEMPERATURE 34.0 #define CENTER_TEMPERATURE 34.0
#define __WAIT_CTS_WHILE_SLEEPING__ #define __WAIT_CTS_WHILE_SLEEPING__
//#define __FFT_VBW__
//#define __FFT_DECONV__ //#define __FFT_DECONV__
#else #else
#endif #endif

@ -35,6 +35,12 @@ float *real2 = (float *) &spi_buffer[1024];
float *imag2 = (float *) &spi_buffer[1536]; float *imag2 = (float *) &spi_buffer[1536];
#endif #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 //#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 __DEBUG_AGC__
#ifdef __FAST_SWEEP__ #ifdef __FAST_SWEEP__
@ -3813,6 +3819,36 @@ static bool sweep(bool break_on_operation)
#ifdef __VBW__ #ifdef __VBW__
#ifdef __FFT_VBW__
if (setting.vbw_x10 != 0 && sweep_points == 256) {
float m = 150;
for (int i=0;i<sweep_points;i++) {
if (m > temp_t[i])
m = temp_t[i];
real[i] = 0;
imag[i] = 0;
actual_t[i] = -150;
}
for (int i=0;i<sweep_points;i++) {
real[i] = temp_t[i] - m;
}
FFT(real, imag, 256, false);
#if 1
for (int i = 128 - setting.vbw_x10; i<128+setting.vbw_x10; i++) {
real[i] = 0;
imag[i] = 0;
}
#endif
FFT(real, imag, 256, true);
for (int i=0;i<sweep_points;i++) {
float re = real[i];
temp_t[i] = re + m;
// actual_t[i] = sqrtf(re*re + im*im) + m;
}
}
#else
// ------------------------ do VBW processing ------------------------------ // ------------------------ do VBW processing ------------------------------
if (setting.frequency_step) { if (setting.frequency_step) {
int vbw_count_div2 = actual_rbw_x10 * 100 / setting.frequency_step / (setting.vbw_x10 == 0 ? 10 : setting.vbw_x10); int vbw_count_div2 = actual_rbw_x10 * 100 / setting.frequency_step / (setting.vbw_x10 == 0 ? 10 : setting.vbw_x10);
@ -3831,6 +3867,7 @@ static bool sweep(bool break_on_operation)
} }
} }
#endif #endif
#endif
#ifdef __FFT_DECONV__ #ifdef __FFT_DECONV__
int d_width = 0; int d_width = 0;
@ -3857,30 +3894,25 @@ static bool sweep(bool break_on_operation)
for (int i=0;i<sweep_points;i++) { for (int i=0;i<sweep_points;i++) {
if (m > temp_t[i]) if (m > temp_t[i])
m = temp_t[i]; m = temp_t[i];
real[i] = 0; real[i] = 0.000000000001;
imag[i] = 0; imag[i] = 0;
real2[0] = 0; real2[0] = 0.000000000001;
imag2[i] = 0; imag2[i] = 0;
actual_t[i] = -150; actual_t[i] = -150;
} }
for (int i=0;i<sweep_points-d_width*4;i++) { for (int i=0;i<sweep_points;i++) {
real[i+d_width*2] = temp_t[i+d_width*2] - m; if (temp_t[i] > m+25)
} real[i] = temp_t[i] - m;
for (int i=0;i<d_width*2;i++) {
real[i] = (temp_t[i] - m) * i/d_width/2;
}
for (int i=0;i<d_width*2;i++) {
real[255-i] = (temp_t[255-i] - m) * i/d_width/2;
} }
FFT(real, imag, 256, false); FFT(real, imag, 256, false);
#if 1
#if 0 #if 0
for (int i = 128 - d_width*2; i<128+d_width*2; i++) { for (int i = 128 - d_width*2; i<128+d_width*2; i++) {
real[i] = 0; real[i] = 0;
imag[i] = 0; imag[i] = 0;
} }
#endif #endif
#if 0 #if 1
for (int i=0;i<d_width/2;i++) { for (int i=0;i<d_width/2;i++) {
real2[i] = (stored_t[i+d_start + d_width/2] - d_offset) / d_scale*4; real2[i] = (stored_t[i+d_start + d_width/2] - d_offset) / d_scale*4;
} }
@ -3896,9 +3928,9 @@ static bool sweep(bool break_on_operation)
// real2[i+256] = (stored_t[i+d_start + d_width/2] - d_offset) / d_scale; // real2[i+256] = (stored_t[i+d_start + d_width/2] - d_offset) / d_scale;
// } // }
#else #else
real2[0] = 2; real2[0] = 1;
real2[1] = 1; // real2[1] = 1;
real2[255] = 1; // real2[255] = 1;
// real2[255] = -0.5; // real2[255] = -0.5;
#endif #endif
#endif #endif
@ -3912,11 +3944,12 @@ static bool sweep(bool break_on_operation)
float cd2 = c*c+d*d; float cd2 = c*c+d*d;
static volatile int dummy; static volatile int dummy;
if (cd2 == 0) if (cd2 == 0)
while(dummy++) ; cd2 = 1e-24;
// while(dummy++) ;
real[i] = (a*c+b*d)/cd2; real[i] = (a*c+b*d)/cd2;
imag[i] = (b*c-a*d)/cd2; imag[i] = (b*c-a*d)/cd2;
} }
#endif
FFT(real, imag, 256, true); FFT(real, imag, 256, true);
for (int i=0;i<sweep_points;i++) { for (int i=0;i<sweep_points;i++) {

Loading…
Cancel
Save

Powered by TurnKey Linux.