1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-08-08 06:53:54 +00:00

some cleaning and optimization

This commit is contained in:
Carles Fernandez 2015-05-07 22:25:46 +02:00
parent c24f312226
commit a7fba9f378

View File

@ -30,7 +30,7 @@
* -------------------------------------------------------------------------
*/
#include "GPS_L2C.h"
#include <gps_l2c_signal.h>
#include <stdlib.h>
#include <stdint.h>
#include <cmath>
@ -95,6 +95,8 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
_ts = 1/(float)_fs; // Sampling period in sec
_tc = 1/(float)_codeFreqBasis; // C/A chip period in sec
float aux;
for (signed int i = 0; i < _samplesPerCode; i++)
{
//=== Digitizing =======================================================
@ -105,7 +107,9 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int
// millisecond).
//TODO: Check this formula! Seems to start with an extra sample
_codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
// _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
aux = (_ts * (i + 1)) / _tc;
_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1;
//--- Make the digitized version of the C/A code -----------------------
// The "upsampled" code is made by selecting values form the CA code