From 42ea31b677c7b09588d10ab7a64c985e277dcef6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 3 Mar 2015 20:40:14 +0100 Subject: [PATCH] Fixing utc and iono info reading when channel 0 is out of lock --- .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) 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