aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorDerek Kozel <derek.kozel@ettus.com>2018-03-19 17:40:24 +0000
committerBrent Stapleton <brent.stapleton@ettus.com>2019-01-14 10:24:08 -0800
commit8027df7a221fc0578495b7426d8318bb878fc2b8 (patch)
treec6beafb55a2be3bf4d7fbf38db4eff29fde89261 /host
parentd89149a84ffc1cf2cd39d4e64d9793a2c1bb38af (diff)
downloaduhd-8027df7a221fc0578495b7426d8318bb878fc2b8.tar.gz
uhd-8027df7a221fc0578495b7426d8318bb878fc2b8.tar.bz2
uhd-8027df7a221fc0578495b7426d8318bb878fc2b8.zip
examples: Improved error message in tx_waveforms
Non-CONST type waveforms require a non-zero wave freq
Diffstat (limited to 'host')
-rw-r--r--host/examples/tx_waveforms.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index c4d850820..1c17e47aa 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -147,8 +147,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::this_thread::sleep_for(std::chrono::seconds(1)); //allow for some setup time
//for the const wave, set the wave freq for small samples per period
- if (wave_freq == 0 and wave_type == "CONST"){
- wave_freq = usrp->get_tx_rate()/2;
+ if (wave_freq == 0){
+ if (wave_type == "CONST"){
+ wave_freq = usrp->get_tx_rate()/2;
+ } else {
+ throw std::runtime_error("wave freq cannot be 0 with wave type other than CONST");
+ }
}
//error when the waveform is not possible to generate