1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 14:04:46 -04:00

SoapySDR support: fixed tunable elements inital settings

This commit is contained in:
f4exb
2018-11-15 22:25:33 +01:00
parent cb9d300109
commit 2ab09f7e6c
6 changed files with 70 additions and 0 deletions
@@ -48,6 +48,7 @@ SoapySDRInput::SoapySDRInput(DeviceSourceAPI *deviceAPI) :
{
openDevice();
initGainSettings(m_settings);
initTunableElementsSettings(m_settings);
initStreamArgSettings(m_settings);
initDeviceArgSettings(m_settings);
@@ -301,6 +302,26 @@ void SoapySDRInput::initGainSettings(SoapySDRInputSettings& settings)
updateGains(m_deviceShared.m_device, m_deviceShared.m_channel, settings);
}
void SoapySDRInput::initTunableElementsSettings(SoapySDRInputSettings& settings)
{
const DeviceSoapySDRParams::ChannelSettings* channelSettings = m_deviceShared.m_deviceParams->getRxChannelSettings(m_deviceShared.m_channel);
settings.m_tunableElements.clear();
bool first = true;
for (const auto &it : channelSettings->m_frequencySettings)
{
if (first)
{
first = false;
continue;
}
settings.m_tunableElements[QString(it.m_name.c_str())] = 0.0;
}
updateTunableElements(m_deviceShared.m_device, m_deviceShared.m_channel, settings);
}
void SoapySDRInput::initStreamArgSettings(SoapySDRInputSettings& settings)
{
const DeviceSoapySDRParams::ChannelSettings* channelSettings = m_deviceShared.m_deviceParams->getRxChannelSettings(m_deviceShared.m_channel);
@@ -719,6 +740,17 @@ void SoapySDRInput::updateGains(SoapySDR::Device *dev, int requestedChannel, Soa
}
}
void SoapySDRInput::updateTunableElements(SoapySDR::Device *dev, int requestedChannel, SoapySDRInputSettings& settings)
{
if (dev == 0) {
return;
}
for (const auto &name : settings.m_tunableElements.keys()) {
settings.m_tunableElements[name] = dev->getFrequency(SOAPY_SDR_RX, requestedChannel, name.toStdString());
}
}
bool SoapySDRInput::handleMessage(const Message& message)
{
if (MsgConfigureSoapySDRInput::match(message))