From eb2ba5ea16445c1cef1fb8dbef72d78dcf8c68a3 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 1 Dec 2016 16:36:59 -0800 Subject: x300: Adding warning for sampling rate coercion --- host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 4bb9c9fb5..bb17eb2ec 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -167,10 +168,14 @@ x300_radio_ctrl_impl::~x300_radio_ctrl_impl() /**************************************************************************** * API calls ***************************************************************************/ -double x300_radio_ctrl_impl::set_rate(double /* rate */) +double x300_radio_ctrl_impl::set_rate(double rate) { + const double actual_rate = get_rate(); + if (not uhd::math::frequencies_are_equal(rate, actual_rate)) { + UHD_MSG(warning) << "[X300 Radio] Requesting invalid sampling rate from device: " << rate/1e6 << " MHz. Actual rate is: " << actual_rate/1e6 << " MHz." << std::endl; + } // On X3x0, tick rate can't actually be changed at runtime - return get_rate(); + return actual_rate; } void x300_radio_ctrl_impl::set_fe_cmd_time(const time_spec_t &time, const size_t chan) -- cgit v1.2.3