From 8027df7a221fc0578495b7426d8318bb878fc2b8 Mon Sep 17 00:00:00 2001 From: Derek Kozel Date: Mon, 19 Mar 2018 17:40:24 +0000 Subject: examples: Improved error message in tx_waveforms Non-CONST type waveforms require a non-zero wave freq --- host/examples/tx_waveforms.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'host/examples') 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 -- cgit v1.2.3