1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-14 04:11:48 -05:00

Fixed Fc position adjustment for Airspy and HackRF

This commit is contained in:
f4exb 2015-10-01 06:34:08 +02:00
parent dc81e2dd9c
commit eb08ef55b3
2 changed files with 32 additions and 30 deletions

View File

@ -276,40 +276,30 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
} }
} }
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
m_settings.m_fcPos = settings.m_fcPos;
if(m_dev != 0)
{
m_airspyThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "AirspyInput: set fc pos (enum) to " << (int) m_settings.m_fcPos;
}
}
qint64 deviceCenterFrequency = m_settings.m_centerFrequency; qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
qint64 f_img = deviceCenterFrequency; qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = m_sampleRates[m_settings.m_devSampleRateIndex]; quint32 devSampleRate = m_sampleRates[m_settings.m_devSampleRateIndex];
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) || if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) ||
(m_settings.m_LOppmTenths != settings.m_LOppmTenths)) (m_settings.m_LOppmTenths != settings.m_LOppmTenths) ||
(m_settings.m_fcPos != settings.m_fcPos))
{ {
m_settings.m_centerFrequency = settings.m_centerFrequency; m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_LOppmTenths = settings.m_LOppmTenths; m_settings.m_LOppmTenths = settings.m_LOppmTenths;
if ((m_settings.m_log2Decim == 0) || (m_settings.m_fcPos == AirspySettings::FC_POS_CENTER)) if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == AirspySettings::FC_POS_CENTER))
{ {
deviceCenterFrequency = m_settings.m_centerFrequency; deviceCenterFrequency = m_settings.m_centerFrequency;
f_img = deviceCenterFrequency; f_img = deviceCenterFrequency;
} }
else else
{ {
if (m_settings.m_fcPos == AirspySettings::FC_POS_INFRA) if (settings.m_fcPos == AirspySettings::FC_POS_INFRA)
{ {
deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4); deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2; f_img = deviceCenterFrequency + devSampleRate/2;
} }
else if (m_settings.m_fcPos == AirspySettings::FC_POS_SUPRA) else if (settings.m_fcPos == AirspySettings::FC_POS_SUPRA)
{ {
deviceCenterFrequency = m_settings.m_centerFrequency - (devSampleRate / 4); deviceCenterFrequency = m_settings.m_centerFrequency - (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2; f_img = deviceCenterFrequency - devSampleRate/2;
@ -330,6 +320,17 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
forwardChange = true; forwardChange = true;
} }
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
m_settings.m_fcPos = settings.m_fcPos;
if(m_dev != 0)
{
m_airspyThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "AirspyInput: set fc pos (enum) to " << (int) m_settings.m_fcPos;
}
}
if ((m_settings.m_lnaGain != settings.m_lnaGain) || force) if ((m_settings.m_lnaGain != settings.m_lnaGain) || force)
{ {
m_settings.m_lnaGain = settings.m_lnaGain; m_settings.m_lnaGain = settings.m_lnaGain;

View File

@ -233,40 +233,30 @@ bool HackRFInput::applySettings(const HackRFSettings& settings, bool force)
} }
} }
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
m_settings.m_fcPos = settings.m_fcPos;
if(m_dev != 0)
{
m_hackRFThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "HackRFInput: set fc pos (enum) to " << (int) m_settings.m_fcPos;
}
}
qint64 deviceCenterFrequency = m_settings.m_centerFrequency; qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
qint64 f_img = deviceCenterFrequency; qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = HackRFSampleRates::m_rates_k[m_settings.m_devSampleRateIndex] * 1000; quint32 devSampleRate = HackRFSampleRates::m_rates_k[m_settings.m_devSampleRateIndex] * 1000;
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) || if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) ||
(m_settings.m_LOppmTenths != settings.m_LOppmTenths)) (m_settings.m_LOppmTenths != settings.m_LOppmTenths) ||
(m_settings.m_fcPos != settings.m_fcPos))
{ {
m_settings.m_centerFrequency = settings.m_centerFrequency; m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_LOppmTenths = settings.m_LOppmTenths; m_settings.m_LOppmTenths = settings.m_LOppmTenths;
if ((m_settings.m_log2Decim == 0) || (m_settings.m_fcPos == HackRFSettings::FC_POS_CENTER)) if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == HackRFSettings::FC_POS_CENTER))
{ {
deviceCenterFrequency = m_settings.m_centerFrequency; deviceCenterFrequency = m_settings.m_centerFrequency;
f_img = deviceCenterFrequency; f_img = deviceCenterFrequency;
} }
else else
{ {
if (m_settings.m_fcPos == HackRFSettings::FC_POS_INFRA) if (settings.m_fcPos == HackRFSettings::FC_POS_INFRA)
{ {
deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4); deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2; f_img = deviceCenterFrequency + devSampleRate/2;
} }
else if (m_settings.m_fcPos == HackRFSettings::FC_POS_SUPRA) else if (settings.m_fcPos == HackRFSettings::FC_POS_SUPRA)
{ {
deviceCenterFrequency = m_settings.m_centerFrequency - (devSampleRate / 4); deviceCenterFrequency = m_settings.m_centerFrequency - (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2; f_img = deviceCenterFrequency - devSampleRate/2;
@ -287,6 +277,17 @@ bool HackRFInput::applySettings(const HackRFSettings& settings, bool force)
forwardChange = true; forwardChange = true;
} }
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
m_settings.m_fcPos = settings.m_fcPos;
if(m_dev != 0)
{
m_hackRFThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "HackRFInput: set fc pos (enum) to " << (int) m_settings.m_fcPos;
}
}
if ((m_settings.m_lnaGain != settings.m_lnaGain) || force) if ((m_settings.m_lnaGain != settings.m_lnaGain) || force)
{ {
m_settings.m_lnaGain = settings.m_lnaGain; m_settings.m_lnaGain = settings.m_lnaGain;