mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Report days, hours, mins and secs instead of secs
This commit is contained in:
		| @@ -41,8 +41,15 @@ gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs) : gr::sync_decimato | |||||||
|     message_port_register_out(pmt::mp("sample_counter")); |     message_port_register_out(pmt::mp("sample_counter")); | ||||||
|     set_max_noutput_items(1); |     set_max_noutput_items(1); | ||||||
|     current_T_rx_ms = 0; |     current_T_rx_ms = 0; | ||||||
|     report_interval_ms = 1000;//default reporting 1 second |     current_s = 0; | ||||||
|  |     current_m = 0; | ||||||
|  |     current_h = 0; | ||||||
|  |     current_days = 0; | ||||||
|  |     report_interval_ms = 1000;     //default reporting 1 second | ||||||
|     flag_enable_send_msg = false;  //enable it for reporting time with asynchronous message |     flag_enable_send_msg = false;  //enable it for reporting time with asynchronous message | ||||||
|  |     flag_m = false; | ||||||
|  |     flag_h = false; | ||||||
|  |     flag_days = false; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -57,12 +64,48 @@ int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)), | |||||||
|     gr_vector_const_void_star &input_items __attribute__((unused)), |     gr_vector_const_void_star &input_items __attribute__((unused)), | ||||||
|     gr_vector_void_star &output_items) |     gr_vector_void_star &output_items) | ||||||
| { | { | ||||||
|     Gnss_Synchro* out = reinterpret_cast<Gnss_Synchro*>(output_items[0]); |     Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); | ||||||
|     out[0] = Gnss_Synchro(); |     out[0] = Gnss_Synchro(); | ||||||
|     if ((current_T_rx_ms % report_interval_ms) == 0) |     if ((current_T_rx_ms % report_interval_ms) == 0) | ||||||
|         { |         { | ||||||
|         std::cout << "Current receiver time: " << static_cast<double>(current_T_rx_ms) / 1000.0 << " [s]" << std::endl; |             current_s++; | ||||||
|         if(flag_enable_send_msg) |             if ((current_s % 60) == 0) | ||||||
|  |                 { | ||||||
|  |                     current_s = 0; | ||||||
|  |                     current_m++; | ||||||
|  |                     flag_m = true; | ||||||
|  |                     if ((current_m % 60) == 0) | ||||||
|  |                         { | ||||||
|  |                             current_m = 0; | ||||||
|  |                             current_h++; | ||||||
|  |                             flag_h = true; | ||||||
|  |                             if ((current_h % 24) == 0) | ||||||
|  |                                 { | ||||||
|  |                                     current_h = 0; | ||||||
|  |                                     current_days++; | ||||||
|  |                                     flag_days = true; | ||||||
|  |                                 } | ||||||
|  |                         } | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |             if (flag_days) | ||||||
|  |                 { | ||||||
|  |                     std::cout << "Current receiver time: " << current_days << " [days] " << current_h << " [h] " << current_m << " [min] " << current_s << " [s]" << std::endl; | ||||||
|  |                 } | ||||||
|  |             else if (flag_h) | ||||||
|  |                 { | ||||||
|  |                     std::cout << "Current receiver time: " << current_h << " [h] " << current_m << " [min] " << current_s << " [s]" << std::endl; | ||||||
|  |                 } | ||||||
|  |             else if (flag_m) | ||||||
|  |                 { | ||||||
|  |                     std::cout << "Current receiver time: " << current_m << " [min] " << current_s << " [s]" << std::endl; | ||||||
|  |                 } | ||||||
|  |             else | ||||||
|  |                 { | ||||||
|  |                     std::cout << "Current receiver time: " << current_s << " [s]" << std::endl; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |             if (flag_enable_send_msg) | ||||||
|                 { |                 { | ||||||
|                     message_port_pub(pmt::mp("receiver_time"), pmt::from_double(static_cast<double>(current_T_rx_ms) / 1000.0)); |                     message_port_pub(pmt::mp("receiver_time"), pmt::from_double(static_cast<double>(current_T_rx_ms) / 1000.0)); | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -44,14 +44,19 @@ gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs); | |||||||
| class gnss_sdr_sample_counter : public gr::sync_decimator | class gnss_sdr_sample_counter : public gr::sync_decimator | ||||||
| { | { | ||||||
| private: | private: | ||||||
|  |  | ||||||
|     gnss_sdr_sample_counter(double _fs); |     gnss_sdr_sample_counter(double _fs); | ||||||
|     long long int current_T_rx_ms; |     long long int current_T_rx_ms;  // Receiver time in ms since the beggining of the run | ||||||
|  |     unsigned int current_s;         // Receiver time in seconds, modulo 60 | ||||||
|  |     bool flag_m;                    // True if the receiver has been running for at least 1 minute | ||||||
|  |     unsigned int current_m;         // Receiver time in minutes, modulo 60 | ||||||
|  |     bool flag_h;                    // True if the receiver has been running for at least 1 hour | ||||||
|  |     unsigned int current_h;         // Receiver time in hours, modulo 24 | ||||||
|  |     bool flag_days;                 // True if the receiver has been running for at least 1 day | ||||||
|  |     unsigned int current_days;      // Receiver time in days since the beggining of the run | ||||||
|     int report_interval_ms; |     int report_interval_ms; | ||||||
|     bool flag_enable_send_msg; |     bool flag_enable_send_msg; | ||||||
|  |  | ||||||
| public: | public: | ||||||
|  |  | ||||||
|     friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs); |     friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs); | ||||||
|     int work(int noutput_items, |     int work(int noutput_items, | ||||||
|         gr_vector_const_void_star &input_items, |         gr_vector_const_void_star &input_items, | ||||||
|   | |||||||
| @@ -89,12 +89,10 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( | |||||||
|         } |         } | ||||||
|     //################# MAKE TRACKING GNURadio object ################### |     //################# MAKE TRACKING GNURadio object ################### | ||||||
|     if (item_type.compare("gr_complex") == 0) |     if (item_type.compare("gr_complex") == 0) | ||||||
|         { |  | ||||||
|             if (unified_) |  | ||||||
|         { |         { | ||||||
|             char sig_[3] = "1C"; |             char sig_[3] = "1C"; | ||||||
|             item_size_ = sizeof(gr_complex); |             item_size_ = sizeof(gr_complex); | ||||||
|                     tracking_unified_ = dll_pll_veml_make_tracking( |             tracking_ = dll_pll_veml_make_tracking( | ||||||
|                 fs_in, vector_length, dump, |                 fs_in, vector_length, dump, | ||||||
|                 dump_filename, pll_bw_hz, dll_bw_hz, |                 dump_filename, pll_bw_hz, dll_bw_hz, | ||||||
|                 pll_bw_narrow_hz, dll_bw_narrow_hz, |                 pll_bw_narrow_hz, dll_bw_narrow_hz, | ||||||
| @@ -106,14 +104,6 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( | |||||||
|                 false, |                 false, | ||||||
|                 'G', sig_); |                 'G', sig_); | ||||||
|         } |         } | ||||||
|             else |  | ||||||
|                 { |  | ||||||
|                     tracking_ = gps_l1_ca_dll_pll_make_tracking_cc( |  | ||||||
|                         0, fs_in, vector_length, dump, |  | ||||||
|                         dump_filename, pll_bw_hz, dll_bw_hz, |  | ||||||
|                         early_late_space_chips); |  | ||||||
|                 } |  | ||||||
|         } |  | ||||||
|     else |     else | ||||||
|         { |         { | ||||||
|             item_size_ = sizeof(gr_complex); |             item_size_ = sizeof(gr_complex); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Antonio Ramos
					Antonio Ramos