From 16ca15bcfd58695c7982114904c80711bd9e81d3 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sun, 4 Oct 2015 00:26:40 +0100 Subject: Fixed fft drawing in gui --- test/ui_gl_waterfall.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'test/ui_gl_waterfall.c') diff --git a/test/ui_gl_waterfall.c b/test/ui_gl_waterfall.c index 3eb3f1f..3c19aca 100644 --- a/test/ui_gl_waterfall.c +++ b/test/ui_gl_waterfall.c @@ -11,7 +11,7 @@ #define CENTER_FREQ 446500000 #define FFT_LEVEL 10 #define FFT_SIZE (1 << FFT_LEVEL) -#define BUF_LENGHT (2 * FFT_SIZE) +#define SAMPLE_LENGHT (2 * FFT_SIZE) #define PRESCALE 8 #define POSTSCALE 2 @@ -105,12 +105,15 @@ int normalise( uint8_t *ibuf, int ilen, uint8_t *obuf, int olen ) int i,j,m; int ppi; + /* if ( ilen >= olen ) { ppi = ilen / olen; } else { return -1; } + */ + ppi = 1; m = 0; i = 0; while ( (i < ilen) && (m < olen) ) @@ -221,29 +224,31 @@ int simple_fft( uint8_t *buf, int len ) { int i,j; uint16_t p; + uint16_t buf1[SAMPLE_LENGHT]; + uint16_t buf2[SAMPLE_LENGHT]; int fft_len; for (i=0; iw; buf = malloc( buf_len ); - sample_len = BUF_LENGHT; + sample_len = SAMPLE_LENGHT; sample_buf = malloc( sample_len ); srand(0); //fake seed @@ -307,16 +313,16 @@ int main() sdr_get_samples( sample_buf, sample_len ); //do fft - simple_fft( sample_buf, sample_len/2 ); + simple_fft( sample_buf, sample_len ); //prepare to show on the screen - if (normalise( sample_buf, sample_len/2, buf, buf_len ) == -1) + //if (normalise( sample_buf, sample_len, buf, buf_len ) == -1) { - printf("Cannot normalise\n"); + //printf("Cannot normalise\n"); } - glui_waterfall_data( t, buf_len, buf ); + glui_waterfall_data( t, sample_len/2, sample_buf ); //printf("\n\b"); - usleep(100000); + usleep(10000); } main_exit: -- cgit v1.2.3