diff options
| author | Martin Braun <martin.braun@ettus.com> | 2021-12-09 11:34:04 +0100 | 
|---|---|---|
| committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-12-16 09:18:47 -0600 | 
| commit | 8972efb73448fc131dac9b314657f7b45d8e9e30 (patch) | |
| tree | 7ca0a360a893f5ca3cbee64bb750db2721397332 /host/examples | |
| parent | 610488690a5f7bf1dd828aa6b9a70dd0874ca87f (diff) | |
| download | uhd-8972efb73448fc131dac9b314657f7b45d8e9e30.tar.gz uhd-8972efb73448fc131dac9b314657f7b45d8e9e30.tar.bz2 uhd-8972efb73448fc131dac9b314657f7b45d8e9e30.zip | |
examples: Fix tx_bursts bandwidth/freq/gain reporting
This example would not specify a channel when querying the actual
frequency/bandwidth/gain after setting it. When using the --channels
options like this:
    tx_bursts --channels 1 --freq 1e9 [...]
...it would request the frequency of 1 GHz on channel 1, then query the
frequency on channel 0 when reporting the "actual" frequency.
Also removes some boost::format().
Diffstat (limited to 'host/examples')
| -rw-r--r-- | host/examples/tx_bursts.cpp | 20 | 
1 files changed, 9 insertions, 11 deletions
| diff --git a/host/examples/tx_bursts.cpp b/host/examples/tx_bursts.cpp index 30660d4df..fc1ff00c9 100644 --- a/host/examples/tx_bursts.cpp +++ b/host/examples/tx_bursts.cpp @@ -111,9 +111,8 @@ int UHD_SAFE_MAIN(int argc, char* argv[])          return ~0;      } -    std::cout << boost::format("Setting TX Freq: %f MHz...") % (freq / 1e6) << std::endl; -    std::cout << boost::format("Setting TX LO Offset: %f MHz...") % (lo_offset / 1e6) -              << std::endl; +    std::cout << "Requesting TX Freq: " << freq / 1e6 << " MHz..." << std::endl; +    std::cout << "Requesting TX LO Offset: " << lo_offset / 1e6 << " MHz..." << std::endl;      for (size_t i = 0; i < channel_nums.size(); i++) {          uhd::tune_request_t tune_request; @@ -123,24 +122,23 @@ int UHD_SAFE_MAIN(int argc, char* argv[])              tune_request.args = uhd::device_addr_t("mode_n=integer");          usrp->set_tx_freq(tune_request, channel_nums[i]);      } -    std::cout << boost::format("Actual TX Freq: %f MHz...") % (usrp->get_tx_freq() / 1e6) -              << std::endl +    std::cout << "Actual TX Freq: " << (usrp->get_tx_freq(channel_nums.front()) / 1e6) +              << " MHz..." << std::endl                << std::endl; -    std::cout << boost::format("Setting TX Gain: %f...") % (gain) << std::endl; +    std::cout << "Requesting TX Gain: " << gain << " dB ..." << std::endl;      for (size_t i = 0; i < channel_nums.size(); i++)          usrp->set_tx_gain(gain, channel_nums[i]); -    std::cout << boost::format("Actual TX Gain: %f...") % (usrp->get_tx_gain()) +    std::cout << "Actual TX Gain: " << (usrp->get_tx_gain(channel_nums.front())) << "..."                << std::endl                << std::endl;      // set the analog frontend filter bandwidth      if (vm.count("bw")) { -        std::cout << boost::format("Setting TX Bandwidth: %f MHz...") % (bw / 1e6) -                  << std::endl; +        std::cout << "Requesting TX Bandwidth: " << (bw / 1e6) << " MHz..." << std::endl;          usrp->set_tx_bandwidth(bw); -        std::cout << boost::format("Actual TX Bandwidth: %f MHz...") -                         % (usrp->get_tx_bandwidth() / 1e6) +        std::cout << "Actual TX Bandwidth: " +                  << usrp->get_tx_bandwidth(channel_nums.front()) / 1e6 << " MHz..."                    << std::endl                    << std::endl;      } | 
