From cf822e376d64144b224cb22b151e9e1a8a7c2f98 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 9 Mar 2014 20:36:23 +0100 Subject: OutputUHD fails if sample rate cannot be set --- src/Log.cpp | 1 + src/OutputUHD.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/Log.cpp b/src/Log.cpp index 684eabe..9b7a2c3 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -82,3 +82,4 @@ LogLine Logger::level(log_level_t level) { return LogLine(this, level); } + diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index cc1afd5..5e66fb3 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -91,6 +91,11 @@ OutputUHD::OutputUHD( myUsrp->set_tx_rate(mySampleRate); MDEBUG("OutputUHD:Actual TX Rate: %f Msps...\n", myUsrp->get_tx_rate()); + if (mySampleRate != myUsrp->get_tx_rate()) { + MDEBUG("OutputUHD: Cannot set sample\n"); + throw std::runtime_error("Cannot set USRP sample rate. Aborted."); + } + //set the centre frequency MDEBUG("OutputUHD:Setting freq to %f...\n", myFrequency); myUsrp->set_tx_freq(myFrequency); -- cgit v1.2.3