mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-05-27 11:44:11 +00:00
Report days, hours, mins and secs instead of secs
This commit is contained in:
parent
ebb908f2e7
commit
843679f0ed
@ -34,15 +34,22 @@
|
|||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
|
||||||
gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs) : gr::sync_decimator("sample_counter",
|
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(gr_complex)),
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
static_cast<unsigned int>(floor(_fs * 0.001)))
|
static_cast<unsigned int>(floor(_fs * 0.001)))
|
||||||
{
|
{
|
||||||
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;
|
||||||
flag_enable_send_msg = false; //enable it for reporting time with asynchronous message
|
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)),
|
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;
|
|
||||||
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++;
|
current_T_rx_ms++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -90,29 +90,19 @@ 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";
|
||||||
{
|
item_size_ = sizeof(gr_complex);
|
||||||
char sig_[3] = "1C";
|
tracking_ = dll_pll_veml_make_tracking(
|
||||||
item_size_ = sizeof(gr_complex);
|
fs_in, vector_length, dump,
|
||||||
tracking_unified_ = dll_pll_veml_make_tracking(
|
dump_filename, pll_bw_hz, dll_bw_hz,
|
||||||
fs_in, vector_length, dump,
|
pll_bw_narrow_hz, dll_bw_narrow_hz,
|
||||||
dump_filename, pll_bw_hz, dll_bw_hz,
|
early_late_space_chips,
|
||||||
pll_bw_narrow_hz, dll_bw_narrow_hz,
|
early_late_space_chips,
|
||||||
early_late_space_chips,
|
early_late_space_narrow_chips,
|
||||||
early_late_space_chips,
|
early_late_space_narrow_chips,
|
||||||
early_late_space_narrow_chips,
|
symbols_extended_correlator,
|
||||||
early_late_space_narrow_chips,
|
false,
|
||||||
symbols_extended_correlator,
|
'G', sig_);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user