1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 06:23:18 +00:00

Report days, hours, mins and secs instead of secs

This commit is contained in:
Antonio Ramos 2018-04-03 11:42:11 +02:00
parent ebb908f2e7
commit 843679f0ed
3 changed files with 77 additions and 39 deletions

View File

@ -34,15 +34,22 @@
#include <gnuradio/io_signature.h>
gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs) : gr::sync_decimator("sample_counter",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
static_cast<unsigned int>(floor(_fs * 0.001)))
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
static_cast<unsigned int>(floor(_fs * 0.001)))
{
message_port_register_out(pmt::mp("sample_counter"));
set_max_noutput_items(1);
current_T_rx_ms = 0;
report_interval_ms = 1000;//default reporting 1 second
flag_enable_send_msg = false; //enable it for reporting time with asynchronous message
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_m = false;
flag_h = false;
flag_days = false;
}
@ -54,19 +61,55 @@ gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs)
int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)),
gr_vector_const_void_star &input_items __attribute__((unused)),
gr_vector_void_star &output_items)
gr_vector_const_void_star &input_items __attribute__((unused)),
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();
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;
if(flag_enable_send_msg)
{
message_port_pub(pmt::mp("receiver_time"), pmt::from_double(static_cast<double>(current_T_rx_ms) / 1000.0));
current_s++;
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));
}
}
}
current_T_rx_ms++;
return 1;
}

View File

@ -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
{
private:
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;
bool flag_enable_send_msg;
public:
friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs);
int work(int noutput_items,
gr_vector_const_void_star &input_items,

View File

@ -90,29 +90,19 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
//################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0)
{
if (unified_)
{
char sig_[3] = "1C";
item_size_ = sizeof(gr_complex);
tracking_unified_ = dll_pll_veml_make_tracking(
fs_in, vector_length, dump,
dump_filename, pll_bw_hz, dll_bw_hz,
pll_bw_narrow_hz, dll_bw_narrow_hz,
early_late_space_chips,
early_late_space_chips,
early_late_space_narrow_chips,
early_late_space_narrow_chips,
symbols_extended_correlator,
false,
'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);
}
char sig_[3] = "1C";
item_size_ = sizeof(gr_complex);
tracking_ = dll_pll_veml_make_tracking(
fs_in, vector_length, dump,
dump_filename, pll_bw_hz, dll_bw_hz,
pll_bw_narrow_hz, dll_bw_narrow_hz,
early_late_space_chips,
early_late_space_chips,
early_late_space_narrow_chips,
early_late_space_narrow_chips,
symbols_extended_correlator,
false,
'G', sig_);
}
else
{