From 2ef60a1b66aded5e967769bf31a97d21c693e805 Mon Sep 17 00:00:00 2001 From: Vidush Date: Tue, 24 Apr 2018 11:21:33 -0700 Subject: ad9361: Fix bandwidth warnings and ranges Allows full bandwidth range to user. Reviewed-by: Michael West Reviewed-by: Martin Braun --- host/lib/usrp/common/ad9361_ctrl.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/common/ad9361_ctrl.cpp') diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp index ea3fdc416..2b6821fc0 100644 --- a/host/lib/usrp/common/ad9361_ctrl.cpp +++ b/host/lib/usrp/common/ad9361_ctrl.cpp @@ -233,10 +233,24 @@ public: double set_bw_filter(const std::string &which, const double bw) { - boost::lock_guard lock(_mutex); - ad9361_device_t::direction_t direction = _get_direction_from_antenna(which); - return _device.set_bw_filter(direction, bw); + double actual_bw = bw; + + { + boost::lock_guard lock(_mutex); + actual_bw = _device.set_bw_filter(direction, bw); + } + + const double min_bw = ad9361_device_t::AD9361_MIN_BW; + const double max_bw = ad9361_device_t::AD9361_MAX_BW; + if (bw < min_bw or bw > max_bw) + { + UHD_LOGGER_WARNING("AD936X") << boost::format( + "The requested bandwidth %f MHz is out of range (%f - %f MHz).\n" + "The bandwidth has been forced to %f MHz.\n" + ) % (bw/1e6) % (min_bw/1e6) % (max_bw/1e6) % (actual_bw/1e6); + } + return actual_bw; } std::vector get_filter_names(const std::string &which) -- cgit v1.2.3