aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Anderseck <martin.anderseck@ni.com>2024-02-13 13:21:34 +0100
committerAki Tomita <121511582+atomita-ni@users.noreply.github.com>2024-02-20 14:40:55 -0600
commitf2e5ab44724d83cf581e04ba7a39806f9f33489d (patch)
tree937a54953d3cff518cb5ae0b90ac8c359785b49d
parentcmake: Add ENABLE_PYMOD_UTILS option, fix venv (diff)
downloaduhd-f2e5ab44724d83cf581e04ba7a39806f9f33489d.tar.xz
uhd-f2e5ab44724d83cf581e04ba7a39806f9f33489d.zip
multi_usrp: Fix setters for ALL_CHANS
Some setters in multi_usrp can take ALL_CHANS as channel parameter, however there were differences between multi_usrp_rfnoc and multi_usrp. This commit fixes this for set_trx_gain().
-rw-r--r--host/lib/usrp/multi_usrp.cpp53
1 files changed, 24 insertions, 29 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 7e5256e93..5ab98fc02 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -1453,38 +1453,28 @@ public:
*************************************************************************/
void set_rx_gain(double gain, const std::string& name, size_t chan) override
{
- /* Check if any AGC mode is enable and if so warn the user */
- if (chan != ALL_CHANS) {
- if (_tree->exists(rx_rf_fe_root(chan) / "gain" / "agc")) {
+ /* Check if any AGC mode is enabled and if so warn the user */
+ for (size_t c = 0; c < get_rx_num_channels(); c++) {
+ if (chan != ALL_CHANS && c != chan) {
+ continue;
+ }
+ if (_tree->exists(rx_rf_fe_root(c) / "gain" / "agc")) {
bool agc =
- _tree->access<bool>(rx_rf_fe_root(chan) / "gain" / "agc" / "enable")
+ _tree->access<bool>(rx_rf_fe_root(c) / "gain" / "agc" / "enable")
.get();
if (agc) {
- UHD_LOGGER_WARNING("MULTI_USRP")
- << "AGC enabled for this channel. Setting will be ignored.";
+ UHD_LOGGER_WARNING("MULTI_USRP") << "AGC enabled for channel " << c
+ << ". Setting will be ignored.";
}
}
- } else {
- for (size_t c = 0; c < get_rx_num_channels(); c++) {
- if (_tree->exists(rx_rf_fe_root(c) / "gain" / "agc")) {
- bool agc = _tree
- ->access<bool>(
- rx_rf_fe_root(chan) / "gain" / "agc" / "enable")
- .get();
- if (agc) {
- UHD_LOGGER_WARNING("MULTI_USRP")
- << "AGC enabled for this channel. Setting will be ignored.";
- }
- }
+ /* Apply gain settings to all channels.
+ * If device is in AGC mode it will ignore the setting. */
+ try {
+ rx_gain_group(c)->set_value(gain, name);
+ } catch (uhd::key_error&) {
+ THROW_GAIN_NAME_ERROR(name, c, rx);
}
}
- /* Apply gain setting.
- * If device is in AGC mode it will ignore the setting. */
- try {
- return rx_gain_group(chan)->set_value(gain, name);
- } catch (uhd::key_error&) {
- THROW_GAIN_NAME_ERROR(name, chan, rx);
- }
}
void set_rx_gain_profile(const std::string& profile, const size_t chan) override
@@ -2011,10 +2001,15 @@ public:
void set_tx_gain(double gain, const std::string& name, size_t chan) override
{
- try {
- return tx_gain_group(chan)->set_value(gain, name);
- } catch (uhd::key_error&) {
- THROW_GAIN_NAME_ERROR(name, chan, tx);
+ for (size_t c = 0; c < get_tx_num_channels(); c++) {
+ if (chan != ALL_CHANS && c != chan) {
+ continue;
+ }
+ try {
+ tx_gain_group(c)->set_value(gain, name);
+ } catch (uhd::key_error&) {
+ THROW_GAIN_NAME_ERROR(name, c, tx);
+ }
}
}