mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
SoapySDR support: fixed tunable elements inital settings
This commit is contained in:
parent
cb9d300109
commit
2ab09f7e6c
@ -44,6 +44,7 @@ SoapySDROutput::SoapySDROutput(DeviceSinkAPI *deviceAPI) :
|
||||
{
|
||||
openDevice();
|
||||
initGainSettings(m_settings);
|
||||
initTunableElementsSettings(m_settings);
|
||||
initStreamArgSettings(m_settings);
|
||||
initDeviceArgSettings(m_settings);
|
||||
}
|
||||
@ -263,6 +264,26 @@ void SoapySDROutput::initGainSettings(SoapySDROutputSettings& settings)
|
||||
updateGains(m_deviceShared.m_device, m_deviceShared.m_channel, settings);
|
||||
}
|
||||
|
||||
void SoapySDROutput::initTunableElementsSettings(SoapySDROutputSettings& settings)
|
||||
{
|
||||
const DeviceSoapySDRParams::ChannelSettings* channelSettings = m_deviceShared.m_deviceParams->getTxChannelSettings(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);
|
||||
}
|
||||
|
||||
const SoapySDR::ArgInfoList& SoapySDROutput::getStreamArgInfoList()
|
||||
{
|
||||
const DeviceSoapySDRParams::ChannelSettings* channelSettings = m_deviceShared.m_deviceParams->getTxChannelSettings(m_deviceShared.m_channel);
|
||||
@ -692,6 +713,17 @@ void SoapySDROutput::updateGains(SoapySDR::Device *dev, int requestedChannel, So
|
||||
}
|
||||
}
|
||||
|
||||
void SoapySDROutput::updateTunableElements(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings)
|
||||
{
|
||||
if (dev == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &name : settings.m_tunableElements.keys()) {
|
||||
settings.m_tunableElements[name] = dev->getFrequency(SOAPY_SDR_TX, requestedChannel, name.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
bool SoapySDROutput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureSoapySDROutput::match(message))
|
||||
|
@ -143,6 +143,7 @@ public:
|
||||
const SoapySDR::ArgInfoList& getStreamArgInfoList();
|
||||
const SoapySDR::ArgInfoList& getDeviceArgInfoList();
|
||||
void initGainSettings(SoapySDROutputSettings& settings);
|
||||
void initTunableElementsSettings(SoapySDROutputSettings& settings);
|
||||
void initStreamArgSettings(SoapySDROutputSettings& settings);
|
||||
void initDeviceArgSettings(SoapySDROutputSettings& settings);
|
||||
bool hasDCAutoCorrection();
|
||||
@ -189,6 +190,7 @@ private:
|
||||
bool applySettings(const SoapySDROutputSettings& settings, bool force = false);
|
||||
bool setDeviceCenterFrequency(SoapySDR::Device *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
||||
void updateGains(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings);
|
||||
void updateTunableElements(SoapySDR::Device *dev, int requestedChannel, SoapySDROutputSettings& settings);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SoapySDROutputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
QVariant webapiVariantFromArgValue(SWGSDRangel::SWGArgValue *argValue);
|
||||
|
@ -72,6 +72,7 @@ SoapySDROutputGui::SoapySDROutputGui(DeviceUISet *deviceUISet, QWidget* parent)
|
||||
createArgumentsControl(m_sampleSink->getDeviceArgInfoList(), true);
|
||||
createArgumentsControl(m_sampleSink->getStreamArgInfoList(), false);
|
||||
m_sampleSink->initGainSettings(m_settings);
|
||||
m_sampleSink->initTunableElementsSettings(m_settings);
|
||||
m_sampleSink->initStreamArgSettings(m_settings);
|
||||
m_sampleSink->initDeviceArgSettings(m_settings);
|
||||
|
||||
|
@ -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))
|
||||
|
@ -165,6 +165,7 @@ public:
|
||||
const SoapySDR::ArgInfoList& getStreamArgInfoList();
|
||||
const SoapySDR::ArgInfoList& getDeviceArgInfoList();
|
||||
void initGainSettings(SoapySDRInputSettings& settings);
|
||||
void initTunableElementsSettings(SoapySDRInputSettings& settings);
|
||||
void initStreamArgSettings(SoapySDRInputSettings& settings);
|
||||
void initDeviceArgSettings(SoapySDRInputSettings& settings);
|
||||
bool hasDCAutoCorrection();
|
||||
@ -212,6 +213,7 @@ private:
|
||||
bool applySettings(const SoapySDRInputSettings& settings, bool force = false);
|
||||
bool setDeviceCenterFrequency(SoapySDR::Device *dev, int requestedChannel, quint64 freq_hz, int loPpmTenths);
|
||||
void updateGains(SoapySDR::Device *dev, int requestedChannel, SoapySDRInputSettings& settings);
|
||||
void updateTunableElements(SoapySDR::Device *dev, int requestedChannel, SoapySDRInputSettings& settings);
|
||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const SoapySDRInputSettings& settings);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
QVariant webapiVariantFromArgValue(SWGSDRangel::SWGArgValue *argValue);
|
||||
|
@ -73,6 +73,7 @@ SoapySDRInputGui::SoapySDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
createArgumentsControl(m_sampleSource->getDeviceArgInfoList(), true);
|
||||
createArgumentsControl(m_sampleSource->getStreamArgInfoList(), false);
|
||||
m_sampleSource->initGainSettings(m_settings);
|
||||
m_sampleSource->initTunableElementsSettings(m_settings);
|
||||
m_sampleSource->initStreamArgSettings(m_settings);
|
||||
m_sampleSource->initDeviceArgSettings(m_settings);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user