1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-09-27 22:58:24 +00:00

Improve initializations and minor fixes

This commit is contained in:
Carles Fernandez 2018-08-17 18:10:53 +02:00
parent 47cc0cf7f9
commit 5d86e68b60
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
9 changed files with 51 additions and 51 deletions

View File

@ -314,7 +314,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
consume_each(1);
d_flag_preamble = false;
uint32_t required_symbols = GALILEO_INAV_PAGE_SYMBOLS + d_symbols_per_preamble;
uint32_t required_symbols = static_cast<uint32_t>(GALILEO_INAV_PAGE_SYMBOLS) + static_cast<uint32_t>(d_symbols_per_preamble);
if (d_symbol_history.size() > required_symbols)
{
@ -427,7 +427,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
{
// TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.TOW_5 * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS);
d_nav.flag_TOW_5 = false;
}
@ -435,20 +435,20 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
{
// TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.TOW_6 * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS);
d_nav.flag_TOW_6 = false;
}
else
{
// this page has no timing information
d_TOW_at_current_symbol_ms += GALILEO_E1_CODE_PERIOD_MS; // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD;
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(GALILEO_E1_CODE_PERIOD_MS); // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD;
}
}
else // if there is not a new preamble, we define the TOW of the current symbol
{
if (d_nav.flag_TOW_set == true)
{
d_TOW_at_current_symbol_ms += GALILEO_E1_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(GALILEO_E1_CODE_PERIOD_MS);
}
}

View File

@ -438,37 +438,37 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
if (d_nav.flag_TOW_1 == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_1 * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
d_nav.flag_TOW_1 = false;
}
else if (d_nav.flag_TOW_2 == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_2 * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
d_nav.flag_TOW_2 = false;
}
else if (d_nav.flag_TOW_3 == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_3 * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
d_nav.flag_TOW_3 = false;
}
else if (d_nav.flag_TOW_4 == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_4 * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
d_nav.flag_TOW_4 = false;
}
else
{
d_TOW_at_current_symbol_ms += GALILEO_E5a_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(GALILEO_E5a_CODE_PERIOD_MS);
}
}
else // if there is not a new preamble, we define the TOW of the current symbol
{
if (d_nav.flag_TOW_set == true)
{
d_TOW_at_current_symbol_ms += GALILEO_E5a_CODE_PERIOD_MS;
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(GALILEO_E5a_CODE_PERIOD_MS);
}
}

View File

@ -82,7 +82,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
n++;
}
}
d_stat = 0;
d_stat = 0U;
d_flag_frame_sync = false;
d_prev_GPS_frame_4bytes = 0;
d_TOW_at_Preamble_ms = 0;
@ -93,8 +93,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
flag_PLL_180_deg_phase_locked = false;
d_preamble_time_samples = 0ULL;
d_TOW_at_current_symbol_ms = 0;
d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size
d_symbol_history.clear(); // Clear all the elements in the buffer
d_symbol_history.set_capacity(GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
d_crc_error_synchronization_counter = 0;
d_current_subframe_symbol = 0;
}
@ -103,6 +102,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
gps_l1_ca_telemetry_decoder_cc::~gps_l1_ca_telemetry_decoder_cc()
{
volk_gnsssdr_free(d_preambles_symbols);
d_symbol_history.clear();
if (d_dump_file.is_open() == true)
{
try

View File

@ -64,8 +64,8 @@ gps_l5_telemetry_decoder_cc::gps_l5_telemetry_decoder_cc(
DLOG(INFO) << "GPS L5 TELEMETRY PROCESSING: satellite " << d_satellite;
d_channel = 0;
d_flag_valid_word = false;
d_TOW_at_current_symbol_ms = 0;
d_TOW_at_Preamble_ms = 0;
d_TOW_at_current_symbol_ms = 0U;
d_TOW_at_Preamble_ms = 0U;
// initialize the CNAV frame decoder (libswiftcnav)
cnav_msg_decoder_init(&d_cnav_decoder);
for (int32_t aux = 0; aux < GPS_L5i_NH_CODE_LENGTH; aux++)

View File

@ -54,7 +54,7 @@ const double GPS_L1_FREQ_HZ = FREQ1; //!< L1 [Hz]
const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s]
const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips]
const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds]
const uint32_t GPS_L1_CA_CODE_PERIOD_MS = 1; //!< GPS L1 C/A code period [ms]
const uint32_t GPS_L1_CA_CODE_PERIOD_MS = 1U; //!< GPS L1 C/A code period [ms]
const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period [seconds]
/*!

View File

@ -229,11 +229,11 @@ Galileo_Navigation_Message::Galileo_Navigation_Message()
}
bool Galileo_Navigation_Message::CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, boost::uint32_t checksum)
bool Galileo_Navigation_Message::CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum)
{
CRC_Galileo_INAV_type CRC_Galileo;
boost::uint32_t crc_computed;
uint32_t crc_computed;
// Galileo INAV frame for CRC is not an integer multiple of bytes
// it needs to be filled with zeroes at the start of the frame.
// This operation is done in the transformation from bits to bytes
@ -290,7 +290,7 @@ uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO
value <<= 1; // shift left
if (bits[GALILEO_PAGE_TYPE_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1ULL; // insert the bit
}
}
}
@ -306,11 +306,11 @@ int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_D
// read the MSB and perform the sign extension
if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1)
{
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable
}
else
{
value &= 0;
value &= 0LL;
}
for (int32_t i = 0; i < num_of_slices; i++)
@ -321,7 +321,7 @@ int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_D
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1LL; // insert the bit
}
}
}

View File

@ -236,10 +236,10 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset<G
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; //shift left
value <<= 1; // shift left
if (bits[GLONASS_GNAV_STRING_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1ULL; // insert the bit
}
}
}
@ -255,20 +255,20 @@ int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset<GLON
// read the MSB and perform the sign extension
if (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1)
{
sign = -1;
sign = -1LL;
}
else
{
sign = 1;
sign = 1LL;
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 1; j < parameter[i].second; j++)
{
value <<= 1; //shift left
value <<= 1; // shift left
if (bits[GLONASS_GNAV_STRING_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1LL; // insert the bit
}
}
}
@ -278,32 +278,32 @@ int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset<GLON
uint32_t Glonass_Gnav_Navigation_Message::get_frame_number(uint32_t satellite_slot_number)
{
uint32_t frame_ID = 0;
uint32_t frame_ID = 0U;
if (satellite_slot_number >= 1 and satellite_slot_number <= 5)
{
frame_ID = 1;
frame_ID = 1U;
}
else if (satellite_slot_number >= 6 and satellite_slot_number <= 10)
{
frame_ID = 2;
frame_ID = 2U;
}
else if (satellite_slot_number >= 11 and satellite_slot_number <= 15)
{
frame_ID = 3;
frame_ID = 3U;
}
else if (satellite_slot_number >= 16 and satellite_slot_number <= 20)
{
frame_ID = 4;
frame_ID = 4U;
}
else if (satellite_slot_number >= 21 and satellite_slot_number <= 24)
{
frame_ID = 5;
frame_ID = 5U;
}
else
{
LOG(WARNING) << "GLONASS GNAV: Invalid Satellite Slot Number";
frame_ID = 0;
frame_ID = 0U;
}
return frame_ID;
@ -313,8 +313,8 @@ uint32_t Glonass_Gnav_Navigation_Message::get_frame_number(uint32_t satellite_sl
int32_t Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{
int32_t J = 0;
d_string_ID = 0;
d_frame_ID = 0;
d_string_ID = 0U;
d_frame_ID = 0U;
// Unpack bytes to bits
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits(frame_string);

View File

@ -99,7 +99,7 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_C
value <<= 1; // shift left
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1ULL; // insert the bit
}
}
}
@ -115,22 +115,22 @@ int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV
// read the MSB and perform the sign extension
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
{
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable
}
else
{
value &= 0;
value &= 0LL;
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; // shift left
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
value <<= 1; // shift left
value &= 0xFFFFFFFFFFFFFFFELL; // reset the corresponding bit (for the 64 bits variable)
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1LL; // insert the bit
}
}
}

View File

@ -184,10 +184,10 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRA
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; //shift left
value <<= 1; // shift left
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1ULL; // insert the bit
}
}
}
@ -203,22 +203,22 @@ int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_
// read the MSB and perform the sign extension
if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1)
{
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable
}
else
{
value &= 0;
value &= 0LL;
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; // shift left
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
value <<= 1; // shift left
value &= 0xFFFFFFFFFFFFFFFELL; // reset the corresponding bit (for the 64 bits variable)
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
value += 1LL; // insert the bit
}
}
}