Skip to content

Commit

Permalink
Merge pull request #1315 from srcejon/fix_uhd_agc
Browse files Browse the repository at this point in the history
USRP: Catch all exceptions from set_rx_agc
  • Loading branch information
f4exb authored Jun 29, 2022
2 parents 280de90 + 5629616 commit a1a3ec2
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions plugins/samplesource/usrpinput/usrpinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,11 @@ bool USRPInput::applySettings(const USRPInputSettings& settings, bool preGetStre
}
else
{
m_deviceShared.m_deviceParams->getDevice()->set_rx_agc(false, m_deviceShared.m_channel);
try {
m_deviceShared.m_deviceParams->getDevice()->set_rx_agc(false, m_deviceShared.m_channel);
} catch (uhd::not_implemented_error &e) {
// Ignore
}
m_deviceShared.m_deviceParams->getDevice()->set_rx_gain(settings.m_gain, m_deviceShared.m_channel);
qDebug() << "USRPInput::applySettings: AGC disabled for channel " << m_deviceShared.m_channel << " set to " << settings.m_gain;
}
Expand Down Expand Up @@ -903,10 +907,20 @@ bool USRPInput::applySettings(const USRPInputSettings& settings, bool preGetStre
// Need to re-set bandwidth and AGG after changing samplerate (and possibly clock source)
m_deviceShared.m_deviceParams->getDevice()->set_rx_bandwidth(settings.m_lpfBW, m_deviceShared.m_channel);
if (settings.m_gainMode == USRPInputSettings::GAIN_AUTO)
m_deviceShared.m_deviceParams->getDevice()->set_rx_agc(true, m_deviceShared.m_channel);
{
try {
m_deviceShared.m_deviceParams->getDevice()->set_rx_agc(true, m_deviceShared.m_channel);
} catch (uhd::not_implemented_error &e) {
// Error message should have been output above
}
}
else
{
m_deviceShared.m_deviceParams->getDevice()->set_rx_agc(false, m_deviceShared.m_channel);
try {
m_deviceShared.m_deviceParams->getDevice()->set_rx_agc(false, m_deviceShared.m_channel);
} catch (uhd::not_implemented_error &e) {
// Ignore
}
m_deviceShared.m_deviceParams->getDevice()->set_rx_gain(settings.m_gain, m_deviceShared.m_channel);
}
}
Expand Down

0 comments on commit a1a3ec2

Please sign in to comment.