1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Fix segmentation fault under certain output combinations

This commit is contained in:
Carles Fernandez 2018-11-03 10:50:19 +01:00
parent 0139447408
commit 6b854c3513
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -401,6 +401,13 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels,
} }
else else
{ {
d_rtcm_MT1019_rate_ms = 0;
d_rtcm_MT1045_rate_ms = 0;
d_rtcm_MT1020_rate_ms = 0;
d_rtcm_MT1077_rate_ms = 0;
d_rtcm_MT1087_rate_ms = 0;
d_rtcm_MT1097_rate_ms = 0;
d_rtcm_MSM_rate_ms = 0;
b_rtcm_enabled = false; b_rtcm_enabled = false;
b_rtcm_writing_started = false; b_rtcm_writing_started = false;
d_rtcm_printer = nullptr; d_rtcm_printer = nullptr;
@ -895,6 +902,8 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
// store valid observables in a map. // store valid observables in a map.
gnss_observables_map.insert(std::pair<int, Gnss_Synchro>(i, in[i][epoch])); gnss_observables_map.insert(std::pair<int, Gnss_Synchro>(i, in[i][epoch]));
} }
if (b_rtcm_enabled)
{
try try
{ {
if (d_ls_pvt->gps_ephemeris_map.empty() == false) if (d_ls_pvt->gps_ephemeris_map.empty() == false)
@ -938,6 +947,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
} }
} }
}
// ############ 2 COMPUTE THE PVT ################################ // ############ 2 COMPUTE THE PVT ################################
if (gnss_observables_map.empty() == false) if (gnss_observables_map.empty() == false)
@ -976,18 +986,27 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
flag_display_pvt = true; flag_display_pvt = true;
} }
if (current_RX_time_ms % d_rtcm_MT1019_rate_ms == 0 and d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0
{
if (current_RX_time_ms % d_rtcm_MT1019_rate_ms == 0)
{ {
flag_write_RTCM_1019_output = true; flag_write_RTCM_1019_output = true;
} }
if (current_RX_time_ms % d_rtcm_MT1020_rate_ms == 0 and d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 }
if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0
{
if (current_RX_time_ms % d_rtcm_MT1020_rate_ms == 0)
{ {
flag_write_RTCM_1020_output = true; flag_write_RTCM_1020_output = true;
} }
if (current_RX_time_ms % d_rtcm_MT1045_rate_ms == 0 and d_rtcm_MT1045_rate_ms != 0) }
if (d_rtcm_MT1045_rate_ms != 0)
{
if (current_RX_time_ms % d_rtcm_MT1045_rate_ms == 0)
{ {
flag_write_RTCM_1045_output = true; flag_write_RTCM_1045_output = true;
} }
}
// TODO: RTCM 1077, 1087 and 1097 are not used, so, disable the output rates // TODO: RTCM 1077, 1087 and 1097 are not used, so, disable the output rates
// if (current_RX_time_ms % d_rtcm_MT1077_rate_ms==0 and d_rtcm_MT1077_rate_ms != 0) // if (current_RX_time_ms % d_rtcm_MT1077_rate_ms==0 and d_rtcm_MT1077_rate_ms != 0)
// { // {
@ -1001,19 +1020,27 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
// { // {
// last_RTCM_1097_output_time = current_RX_time; // last_RTCM_1097_output_time = current_RX_time;
// } // }
if (d_rtcm_MSM_rate_ms != 0)
if (current_RX_time_ms % d_rtcm_MSM_rate_ms == 0 and d_rtcm_MSM_rate_ms != 0) {
if (current_RX_time_ms % d_rtcm_MSM_rate_ms == 0)
{ {
flag_write_RTCM_MSM_output = true; flag_write_RTCM_MSM_output = true;
} }
}
if (d_rinexobs_rate_ms != 0)
{
if (current_RX_time_ms % static_cast<uint32_t>(d_rinexobs_rate_ms) == 0) if (current_RX_time_ms % static_cast<uint32_t>(d_rinexobs_rate_ms) == 0)
{ {
flag_write_RINEX_obs_output = true; flag_write_RINEX_obs_output = true;
} }
}
if (d_rinexnav_rate_ms != 0)
{
if (current_RX_time_ms % static_cast<uint32_t>(d_rinexnav_rate_ms) == 0) if (current_RX_time_ms % static_cast<uint32_t>(d_rinexnav_rate_ms) == 0)
{ {
flag_write_RINEX_nav_output = true; flag_write_RINEX_nav_output = true;
} }
}
if (first_fix == true) if (first_fix == true)
{ {