mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
SoapySDR support: input: auto correction GUIs (3)
This commit is contained in:
parent
e5748444c5
commit
90de728990
@ -973,6 +973,54 @@ bool SoapySDRInput::applySettings(const SoapySDRInputSettings& settings, bool fo
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_autoDCCorrection != settings.m_autoDCCorrection) || force)
|
||||
{
|
||||
if ((dev != 0) && hasDCAutoCorrection())
|
||||
{
|
||||
try
|
||||
{
|
||||
dev->setDCOffsetMode(SOAPY_SDR_RX, requestedChannel, settings.m_autoDCCorrection);
|
||||
qDebug("SoapySDRInput::applySettings: %s DC auto correction", settings.m_autoGain ? "set" : "unset");
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
qCritical("SoapySDRInput::applySettings: cannot %s DC auto correction", settings.m_autoGain ? "set" : "unset");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_dcCorrection != settings.m_dcCorrection) || force)
|
||||
{
|
||||
if ((dev != 0) && hasDCCorrectionValue())
|
||||
{
|
||||
try
|
||||
{
|
||||
dev->setDCOffset(SOAPY_SDR_RX, requestedChannel, settings.m_dcCorrection);
|
||||
qDebug("SoapySDRInput::applySettings: DC offset correction set to (%lf, %lf)", settings.m_dcCorrection.real(), settings.m_dcCorrection.imag());
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
qCritical("SoapySDRInput::applySettings: cannot set DC offset correction to (%lf, %lf)", settings.m_dcCorrection.real(), settings.m_dcCorrection.imag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
|
||||
{
|
||||
if ((dev != 0) && hasIQCorrectionValue())
|
||||
{
|
||||
try
|
||||
{
|
||||
dev->setIQBalance(SOAPY_SDR_RX, requestedChannel, settings.m_iqCorrection);
|
||||
qDebug("SoapySDRInput::applySettings: IQ balance correction set to (%lf, %lf)", settings.m_iqCorrection.real(), settings.m_iqCorrection.imag());
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
qCritical("SoapySDRInput::applySettings: cannot set IQ balance correction to (%lf, %lf)", settings.m_iqCorrection.real(), settings.m_iqCorrection.imag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (forwardChangeOwnDSP)
|
||||
{
|
||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
||||
|
@ -43,6 +43,8 @@ void SoapySDRInputSettings::resetToDefaults()
|
||||
m_autoGain = false;
|
||||
m_autoDCCorrection = false;
|
||||
m_autoIQCorrection = false;
|
||||
m_dcCorrection = std::complex<double>{0,0};
|
||||
m_iqCorrection = std::complex<double>{0,0};
|
||||
}
|
||||
|
||||
QByteArray SoapySDRInputSettings::serialize() const
|
||||
@ -65,6 +67,10 @@ QByteArray SoapySDRInputSettings::serialize() const
|
||||
s.writeBool(14, m_autoGain);
|
||||
s.writeBool(15, m_autoDCCorrection);
|
||||
s.writeBool(16, m_autoIQCorrection);
|
||||
s.writeDouble(17, m_dcCorrection.real());
|
||||
s.writeDouble(18, m_dcCorrection.imag());
|
||||
s.writeDouble(19, m_iqCorrection.real());
|
||||
s.writeDouble(20, m_iqCorrection.imag());
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -83,6 +89,7 @@ bool SoapySDRInputSettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
int intval;
|
||||
QByteArray blob;
|
||||
double realval, imagval;
|
||||
|
||||
d.readS32(1, &m_devSampleRate, 1024000);
|
||||
d.readU32(2, &m_log2Decim, 0);
|
||||
@ -103,6 +110,12 @@ bool SoapySDRInputSettings::deserialize(const QByteArray& data)
|
||||
d.readBool(14, &m_autoGain, false);
|
||||
d.readBool(15, &m_autoDCCorrection, false);
|
||||
d.readBool(16, &m_autoIQCorrection, false);
|
||||
d.readDouble(17, &realval, 0);
|
||||
d.readDouble(18, &imagval, 0);
|
||||
m_dcCorrection = std::complex<double>{realval, imagval};
|
||||
d.readDouble(19, &realval, 0);
|
||||
d.readDouble(20, &imagval, 0);
|
||||
m_iqCorrection = std::complex<double>{realval, imagval};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ struct SoapySDRInputSettings {
|
||||
bool m_autoGain;
|
||||
bool m_autoDCCorrection;
|
||||
bool m_autoIQCorrection;
|
||||
std::complex<float> m_dcCorrection;
|
||||
std::complex<float> m_iqCorrection;
|
||||
std::complex<double> m_dcCorrection;
|
||||
std::complex<double> m_iqCorrection;
|
||||
|
||||
SoapySDRInputSettings();
|
||||
void resetToDefaults();
|
||||
|
Loading…
Reference in New Issue
Block a user