Commit 0af48666 authored by Thomas Telkamp's avatar Thomas Telkamp
Browse files

clean up

parent 2184465a
......@@ -107,10 +107,7 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
uhd::rx_metadata_t md;
std::vector<samp_type> buff(samps_per_buff);
// std::ofstream outfile;
// if (not null)
// outfile.open(file.c_str(), std::ofstream::binary);
bool overflow_message = true;
bool first_frame = true;
......@@ -137,9 +134,6 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
}
rx_stream->issue_stream_cmd(stream_cmd);
// typedef std::map<size_t, size_t> SizeMap;
// SizeMap mapSizes;
// Track time and samps between updating the BW summary
auto last_update = start_time;
unsigned long long last_update_samps = 0;
......@@ -174,8 +168,6 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
"Got an overflow indication. Please consider the following:\n"
" Your write medium must sustain a rate of %fMB/s.\n"
" Dropped samples will not be written to the file.\n")
// " Please modify this example for your purposes.\n"
// " This message will not appear again.\n")
% (usrp->get_rx_rate(channel) * sizeof(samp_type) / 1e6);
break;
}
......@@ -201,20 +193,9 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
}
stream_cmd.stream_now = false;
// if (enable_size_map) {
// SizeMap::iterator it = mapSizes.find(num_rx_samps);
// if (it == mapSizes.end())
// mapSizes[num_rx_samps] = 0;
// mapSizes[num_rx_samps] += 1;
// }
num_total_samps += num_rx_samps;
// if (outfile.is_open()) {
// outfile.write((const char*)&buff.front(), num_rx_samps * sizeof(samp_type));
// }
memcpy((void*)writepointer, (const char*)&buff.front(), num_rx_samps * sizeof(samp_type));
numbytes = num_rx_samps * sizeof(samp_type);
......@@ -277,10 +258,6 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
stream_cmd.stream_mode = uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS;
rx_stream->issue_stream_cmd(stream_cmd);
// if (outfile.is_open()) {
// outfile.close();
// }
if (stats) {
std::cout << std::endl;
const double actual_duration_seconds =
......@@ -291,13 +268,6 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
<< std::endl;
const double rate = (double)num_total_samps / actual_duration_seconds;
std::cout << (rate / 1e6) << " Msps" << std::endl;
// if (enable_size_map) {
// std::cout << std::endl;
// std::cout << "Packet size map (bytes: count)" << std::endl;
// for (SizeMap::iterator it = mapSizes.begin(); it != mapSizes.end(); it++)
// std::cout << it->first << ":\t" << it->second << std::endl;
// }
}
}
......@@ -366,7 +336,6 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
("type", po::value<std::string>(&type)->default_value("short"), "sample type: double, float, or short")
("nsamps", po::value<size_t>(&total_num_samps)->default_value(0), "total number of samples to receive")
("duration", po::value<double>(&total_time)->default_value(0), "total number of seconds to receive")
// ("time", po::value<double>(&total_time), "(DEPRECATED) will go away soon! Use --duration instead")
("spb", po::value<size_t>(&spb)->default_value(10000), "samples per buffer")
("rate", po::value<double>(&rate)->default_value(1e6), "rate of incoming samples")
("freq", po::value<double>(&freq)->default_value(0.0), "RF center frequency in Hz")
......@@ -382,7 +351,6 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
("setup", po::value<double>(&setup_time)->default_value(1.0), "seconds of setup time")
("progress", "periodically display short-term bandwidth")
("stats", "show average bandwidth on exit")
// ("sizemap", "track packet size and display breakdown on exit")
("pps", "use external pps signal")
("int-second", "align start of reception to integer second")
("null", "run without writing to file")
......@@ -408,13 +376,8 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
bool bw_summary = vm.count("progress") > 0;
bool stats = vm.count("stats") > 0;
bool null = vm.count("null") > 0;
bool enable_size_map = vm.count("sizemap") > 0;
bool continue_on_bad_packet = vm.count("continue") > 0;
// if (enable_size_map)
// std::cout << "Packet size tracking enabled - will only recv one packet at a time!"
// << std::endl;
// create a usrp device
if (not vm["args"].defaulted()) {
......@@ -563,10 +526,9 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
uhd::time_spec_t last_pps_time = usrp->get_time_last_pps();
// we only care about the full seconds
signed gps_seconds; // = gps_time.to_int();
long long pps_seconds; // = 0; // last_pps_time.to_ticks(1.0);
signed gps_seconds;
long long pps_seconds;
// if (pps_seconds != gps_seconds) {
do {
std::cout << "\nTrying to align the device time to GPS time..." << std::endl;
......@@ -608,14 +570,6 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
std::cout << boost::format("PC Clock time: %.6f seconds\n") % (time_now.tv_sec + (double)time_now.tv_usec / 1e6);
}
// TEST
// const auto sensors = usrp->get_rx_sensor_names(channel);
// for (const auto& sensor : sensors) {
// const auto sensor_value = usrp->get_rx_sensor(sensor, channel);
// std::cout << "* " << sensor_value.to_pp_string() << std::endl;
// }
// END TEST
if (total_num_samps == 0) {
std::signal(SIGINT, &sig_int_handler);
std::cout << "Press Ctrl + C to stop streaming..." << std::endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment