From 02eda1fd92ee0cdc428ed9baad00d6a0aae3efa5 Mon Sep 17 00:00:00 2001 From: Mike Walters Date: Sat, 30 Jul 2016 18:43:43 +0100 Subject: [PATCH] Take samples from the end of the buffer --- host/hackrf-tools/src/hackrf_sweep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index d504f530..e5f95a53 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -200,12 +200,12 @@ int rx_callback(hackrf_transfer* transfer) { frequency = *(uint16_t*)&buf[2]; } /* copy to fftwIn as floats */ - buf += 4; + buf += 16384 - (fftSize * 2); for(i=0; i < fftSize; i++) { fftwIn[i][0] = buf[i*2] * window[i] * 1.0f / 128.0f; fftwIn[i][1] = buf[i*2+1] * window[i] * 1.0f / 128.0f; } - buf = buf + 16380; + buf += fftSize * 2; fftwf_execute(fftwPlan); for (i=0; i < fftSize; i++) { // Start from the middle of the FFTW array and wrap