mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Minor changes
This commit is contained in:
parent
f92dd4dc83
commit
ad220dd279
@ -172,7 +172,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
unsigned int required_symbols = GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
|
unsigned int required_symbols = GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
|
|
||||||
if (d_symbol_history.size() > required_symbols and d_make_correlation)
|
if ((d_symbol_history.size() > required_symbols) and (d_make_correlation or !d_flag_frame_sync))
|
||||||
{
|
{
|
||||||
//******* preamble correlation ********
|
//******* preamble correlation ********
|
||||||
for (unsigned int i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
|
for (unsigned int i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
|
||||||
@ -181,24 +181,22 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
{
|
{
|
||||||
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
||||||
{
|
{
|
||||||
corr_value -= d_preambles_symbols[i] * d_symbol_history.at(i).correlation_length_ms;
|
corr_value -= d_preambles_symbols[i];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
corr_value += d_preambles_symbols[i] * d_symbol_history.at(i).correlation_length_ms;
|
corr_value += d_preambles_symbols[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (corr_value >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
}
|
||||||
|
if (std::abs(corr_value) >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
||||||
{
|
{
|
||||||
d_symbol_counter_corr = 0;
|
d_symbol_counter_corr++;
|
||||||
d_make_correlation = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******* frame sync ******************
|
//******* frame sync ******************
|
||||||
if (abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
if (std::abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
||||||
{
|
{
|
||||||
//TODO: Rewrite with state machine
|
//TODO: Rewrite with state machine
|
||||||
if (d_stat == 0)
|
if (d_stat == 0)
|
||||||
@ -215,12 +213,14 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
else if (d_stat == 1) //check 6 seconds of preamble separation
|
else if (d_stat == 1) //check 6 seconds of preamble separation
|
||||||
{
|
{
|
||||||
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
preamble_diff_ms = std::round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||||
if (abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1)
|
if (std::abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite;
|
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite;
|
||||||
d_GPS_FSM.Event_gps_word_preamble();
|
d_GPS_FSM.Event_gps_word_preamble();
|
||||||
d_flag_preamble = true;
|
d_flag_preamble = true;
|
||||||
|
d_make_correlation = false;
|
||||||
|
d_symbol_counter_corr = 0;
|
||||||
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; // record the PRN start sample index associated to the preamble
|
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; // record the PRN start sample index associated to the preamble
|
||||||
if (!d_flag_frame_sync)
|
if (!d_flag_frame_sync)
|
||||||
{
|
{
|
||||||
@ -245,6 +245,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
d_symbol_counter_corr++;
|
||||||
|
if (d_symbol_counter_corr > (GPS_SUBFRAME_MS - GPS_CA_TELEMETRY_SYMBOLS_PER_BIT))
|
||||||
|
{
|
||||||
|
d_make_correlation = true;
|
||||||
|
}
|
||||||
if (d_stat == 1)
|
if (d_stat == 1)
|
||||||
{
|
{
|
||||||
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||||
@ -254,6 +259,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
d_stat = 0; //lost of frame sync
|
d_stat = 0; //lost of frame sync
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
flag_TOW_set = false;
|
flag_TOW_set = false;
|
||||||
|
d_make_correlation = true;
|
||||||
|
d_symbol_counter_corr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user