1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

Fix bug un pcps_acquisition_cc::set_local_code

Assign the length of the code correctly to the FFT

Resolves: #25
This commit is contained in:
Luis Esteve 2016-05-13 05:16:59 +02:00
parent 0f599a1e6a
commit 7ea560f3f7

View File

@ -162,13 +162,17 @@ void pcps_acquisition_cc::set_local_code(std::complex<float> * code)
// Here we want to create a buffer that looks like this: // Here we want to create a buffer that looks like this:
// [ 0 0 0 ... 0 c_0 c_1 ... c_L] // [ 0 0 0 ... 0 c_0 c_1 ... c_L]
// where c_i is the local code and there are L zeros and L chips // where c_i is the local code and there are L zeros and L chips
int offset = 0;
if( d_bit_transition_flag ) if( d_bit_transition_flag )
{ {
std::fill_n( d_fft_if->get_inbuf(), d_samples_per_code, gr_complex( 0.0, 0.0 ) ); int offset = d_fft_size/2;
offset = d_samples_per_code; std::fill_n( d_fft_if->get_inbuf(), offset, gr_complex( 0.0, 0.0 ) );
memcpy(d_fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * offset);
}
else
{
memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size);
} }
memcpy(d_fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * d_samples_per_code);
d_fft_if->execute(); // We need the FFT of local code d_fft_if->execute(); // We need the FFT of local code
volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size); volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
} }