diff options
3 files changed, 19 insertions, 11 deletions
diff --git a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp index 36fb5bc23..a8de3aa51 100644 --- a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp @@ -227,7 +227,9 @@ double rhodium_radio_ctrl_impl::set_tx_frequency( _rpcc->notify_with_token(_rpc_prefix + "enable_tx_lowband_lo", (!is_highband)); } _update_tx_freq_switches(coerced_freq); - _update_corrections(get_tx_lo_source(RHODIUM_LO1, 0), coerced_freq, TX_DIRECTION); + const bool enable_corrections = is_highband + and (get_tx_lo_source(RHODIUM_LO1, 0) == "internal"); + _update_corrections(actual_lo_freq, TX_DIRECTION, enable_corrections); // if TX lowband/highband changed and antenna is TX/RX, // the ATR and SW1 need to be updated _update_tx_output_switches(get_tx_antenna(0)); @@ -280,7 +282,9 @@ double rhodium_radio_ctrl_impl::set_rx_frequency( _rpcc->notify_with_token(_rpc_prefix + "enable_rx_lowband_lo", (!is_highband)); } _update_rx_freq_switches(coerced_freq); - _update_corrections(get_rx_lo_source(RHODIUM_LO1, 0), coerced_freq, RX_DIRECTION); + const bool enable_corrections = is_highband + and (get_rx_lo_source(RHODIUM_LO1, 0) == "internal"); + _update_corrections(actual_lo_freq, RX_DIRECTION, enable_corrections); return coerced_freq; } @@ -449,20 +453,20 @@ void rhodium_radio_ctrl_impl::_update_atr( } void rhodium_radio_ctrl_impl::_update_corrections( - const std::string lo_source, const double freq, - const direction_t dir) + const direction_t dir, + const bool enable) { const std::string fe_path_part = dir == RX_DIRECTION ? "rx_fe_corrections" : "tx_fe_corrections"; const fs_path fe_corr_path = _root_path / fe_path_part / 0; const fs_path dboard_path = fs_path("dboards") / _radio_slot; - if (lo_source == "internal") + if (enable) { UHD_LOG_DEBUG(unique_id(), - "Enabling frontend corrections for " - << ((dir == RX_DIRECTION) ? "RX" : "TX")); + "Loading any available frontend corrections for " + << ((dir == RX_DIRECTION) ? "RX" : "TX") << " at " << freq); if (dir == RX_DIRECTION) { apply_rx_fe_corrections(_tree, dboard_path, fe_corr_path, freq); } else { diff --git a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.hpp index d88326b4f..fad987b98 100644 --- a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.hpp @@ -218,8 +218,8 @@ private: // ATR registers control SW10 and the frontend LEDs. void _update_atr(const std::string& ant, const direction_t dir); - //! Configure DSP core corrections based on current frequency and LO source - void _update_corrections(const std::string lo_source, const double freq, const direction_t dir); + //! Configure DSP core corrections based on current frequency + void _update_corrections(const double freq, const direction_t dir, const bool enable); //! Map a frequency in Hz to an rx_band value. Will return // rx_band::INVALID_BAND if the frequency is out of range. diff --git a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_lo.cpp b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_lo.cpp index 8567229d8..405862485 100644 --- a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_lo.cpp +++ b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_lo.cpp @@ -264,7 +264,9 @@ void rhodium_radio_ctrl_impl::set_tx_lo_source( throw uhd::value_error(str(boost::format("set_tx_lo_source was called with an invalid LO source: %s Valid sources are [internal, external]") % src)); } - _update_corrections(src, get_tx_frequency(0), TX_DIRECTION); + const bool enable_corrections = not _is_tx_lowband(get_tx_frequency(0)) + and src == "internal"; + _update_corrections(get_tx_frequency(0), TX_DIRECTION, enable_corrections); _tx_lo_source = src; } @@ -295,7 +297,9 @@ void rhodium_radio_ctrl_impl::set_rx_lo_source( throw uhd::value_error(str(boost::format("set_rx_lo_source was called with an invalid LO source: %s Valid sources for LO1 are [internal, external]") % src)); } - _update_corrections(src, get_rx_frequency(0), RX_DIRECTION); + const bool enable_corrections = not _is_rx_lowband(get_rx_frequency(0)) + and src == "internal"; + _update_corrections(get_rx_frequency(0), RX_DIRECTION, enable_corrections); _rx_lo_source = src; } |