mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-29 02:14:51 +00:00
Improving GPS L1 CA telemetry decoder
This commit is contained in:
parent
8ab202b666
commit
547559c0b8
@ -218,8 +218,6 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
uint32_t GPS_frame_4bytes = 0;
|
||||
float symbol_accumulator = 0;
|
||||
bool subframe_synchro_confirmation = false;
|
||||
bool CRC_ok = true;
|
||||
|
||||
for (float subframe_symbol : d_symbol_history)
|
||||
{
|
||||
// ******* SYMBOL TO BIT *******
|
||||
@ -269,11 +267,6 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
{
|
||||
subframe_synchro_confirmation = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// std::cout << "word invalid sat " << this->d_satellite << std::endl;
|
||||
CRC_ok = false;
|
||||
}
|
||||
// add word to subframe
|
||||
// insert the word in the correct position of the subframe
|
||||
std::memcpy(&subframe[word_index * GPS_WORD_LENGTH], &GPS_frame_4bytes, sizeof(uint32_t));
|
||||
@ -290,7 +283,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
|
||||
// decode subframe
|
||||
// NEW GPS SUBFRAME HAS ARRIVED!
|
||||
if (CRC_ok)
|
||||
if (subframe_synchro_confirmation)
|
||||
{
|
||||
int32_t subframe_ID = d_nav.subframe_decoder(subframe); //decode the subframe
|
||||
if (subframe_ID > 0 and subframe_ID < 6)
|
||||
@ -329,21 +322,24 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return subframe_synchro_confirmation;
|
||||
}
|
||||
|
||||
|
||||
void gps_l1_ca_telemetry_decoder_gs::reset()
|
||||
{
|
||||
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
||||
d_last_valid_preamble = d_sample_counter;
|
||||
d_sent_tlm_failed_msg = false;
|
||||
flag_TOW_set = false;
|
||||
d_symbol_history.clear();
|
||||
d_stat = 0;
|
||||
DLOG(INFO) << "Telemetry decoder reset for satellite " << d_satellite;
|
||||
}
|
||||
|
||||
@ -400,6 +396,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
DLOG(INFO) << "Preamble detection for GPS L1 satellite " << this->d_satellite;
|
||||
d_stat = 1; // enter into frame pre-detection status
|
||||
}
|
||||
flag_TOW_set = false;
|
||||
break;
|
||||
}
|
||||
case 1: // possible preamble lock
|
||||
@ -438,6 +435,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
if (preamble_diff > d_preamble_period_symbols)
|
||||
{
|
||||
d_stat = 0; // start again
|
||||
flag_TOW_set = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -486,9 +484,16 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
// 2. Add the telemetry decoder information
|
||||
if (d_flag_preamble == true)
|
||||
{
|
||||
d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
|
||||
flag_TOW_set = true;
|
||||
if (!d_nav.d_TOW == 0)
|
||||
{
|
||||
d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
|
||||
flag_TOW_set = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DLOG(INFO) << "Received GPS L1 TOW equal to zero at sat " << d_nav.i_satellite_PRN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user