diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc index 6bc064349..4329d5c52 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc @@ -168,14 +168,40 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite if (global_gps_utc_model_map.size() > 0) { - // UTC MODEL data is shared for all the GPS satellites. Read always at ID=0 - global_gps_utc_model_map.read(0, d_ls_pvt->gps_utc_model); + // UTC MODEL data is shared for all the GPS satellites. Read always at a locked channel + int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_gps_utc_model_map.read(i, d_ls_pvt->gps_utc_model); + break; + } + i++; + if (i == d_nchannels - 1) + { + break; + } + } } if (global_gps_iono_map.size() > 0) { - // IONO data is shared for all the GPS satellites. Read always at ID=0 - global_gps_iono_map.read(0, d_ls_pvt->gps_iono); + // IONO data is shared for all the GPS satellites. Read always at a locked channel + int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_gps_iono_map.read(i, d_ls_pvt->gps_iono); + break; + } + i++; + if (i == d_nchannels - 1) + { + break; + } + } } // update SBAS data collections