Airspy, BladeRF, HackRF, PlutoSDR, RTLSDR, SDRPlay: fixed frequency setting when changing decimation with fc position change

pull/127/head
f4exb 2018-01-20 03:28:30 +01:00
rodzic ce499c73bb
commit 057a8f94bb
14 zmienionych plików z 144 dodań i 219 usunięć

Wyświetl plik

@ -393,23 +393,24 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_log2Decim = settings.m_log2Decim;
forwardChange = true;
if (m_airspyThread != 0)
{
m_airspyThread->setLog2Decimation(m_settings.m_log2Decim);
qDebug() << "AirspyInput: set decimation to " << (1<<m_settings.m_log2Decim);
m_airspyThread->setLog2Decimation(settings.m_log2Decim);
qDebug() << "AirspyInput: set decimation to " << (1<<settings.m_log2Decim);
}
}
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force)
{
m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_log2Decim = settings.m_log2Decim;
m_settings.m_transverterMode = settings.m_transverterMode;
m_settings.m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
m_settings.m_LOppmTenths = settings.m_LOppmTenths;

Wyświetl plik

@ -29,7 +29,7 @@ const int AirspyPlugin::m_maxDevices = 32;
const PluginDescriptor AirspyPlugin::m_pluginDescriptor = {
QString("Airspy Input"),
QString("3.9.0"),
QString("3.11.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -514,69 +514,80 @@ bool BladerfInput::applySettings(const BladeRFInputSettings& settings, bool forc
}
}
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_log2Decim = settings.m_log2Decim;
forwardChange = true;
if (m_bladerfThread != 0)
{
m_bladerfThread->setLog2Decimation(m_settings.m_log2Decim);
qDebug() << "BladerfInput::applySettings: set decimation to " << (1<<m_settings.m_log2Decim);
}
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
m_settings.m_fcPos = settings.m_fcPos;
if (m_bladerfThread != 0)
{
m_bladerfThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "BladerfInput::applySettings: set fc pos (enum) to " << (int) m_settings.m_fcPos;
m_bladerfThread->setFcPos((int) settings.m_fcPos);
qDebug() << "BladerfInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos;
}
}
if (m_settings.m_centerFrequency != settings.m_centerFrequency)
{
forwardChange = true;
}
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_log2Decim = settings.m_log2Decim;
forwardChange = true;
m_settings.m_centerFrequency = settings.m_centerFrequency;
if (m_bladerfThread != 0)
{
m_bladerfThread->setLog2Decimation(m_settings.m_log2Decim);
qDebug() << "BladerfInput::applySettings: set decimation to " << (1<<m_settings.m_log2Decim);
}
}
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
qint64 f_img = deviceCenterFrequency;
qint64 f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_log2Decim = settings.m_log2Decim;
m_settings.m_fcPos = settings.m_fcPos;
if ((m_settings.m_log2Decim == 0) || (m_settings.m_fcPos == BladeRFInputSettings::FC_POS_CENTER))
{
deviceCenterFrequency = m_settings.m_centerFrequency;
f_img = deviceCenterFrequency;
f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
}
else
{
if (m_settings.m_fcPos == BladeRFInputSettings::FC_POS_INFRA)
{
deviceCenterFrequency = m_settings.m_centerFrequency + (m_settings.m_devSampleRate / 4);
f_img = deviceCenterFrequency + m_settings.m_devSampleRate/2;
f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
}
else if (m_settings.m_fcPos == BladeRFInputSettings::FC_POS_SUPRA)
{
deviceCenterFrequency = m_settings.m_centerFrequency - (m_settings.m_devSampleRate / 4);
f_img = deviceCenterFrequency - m_settings.m_devSampleRate/2;
f_cut = deviceCenterFrequency - m_settings.m_bandwidth/2;
}
}
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
qint64 f_img = deviceCenterFrequency;
qint64 f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
quint32 devSampleRate = m_settings.m_devSampleRate;
if (m_dev != NULL)
{
if (bladerf_set_frequency( m_dev, BLADERF_MODULE_RX, deviceCenterFrequency ) != 0)
{
qDebug("BladerfInput::applySettings: bladerf_set_frequency(%lld) failed", m_settings.m_centerFrequency);
}
}
forwardChange = true;
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == BladeRFInputSettings::FC_POS_CENTER))
{
f_img = deviceCenterFrequency;
}
else
{
if (settings.m_fcPos == BladeRFInputSettings::FC_POS_INFRA)
{
deviceCenterFrequency += (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2;
}
else if (settings.m_fcPos == BladeRFInputSettings::FC_POS_SUPRA)
{
deviceCenterFrequency -= (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2;
}
}
if (m_dev != 0)
{
if (bladerf_set_frequency( m_dev, BLADERF_MODULE_RX, deviceCenterFrequency ) != 0)
{
qDebug("BladerfInput::applySettings: bladerf_set_frequency(%lld) failed", m_settings.m_centerFrequency);
}
else
{
qDebug() << "BladerfInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz"
<< " device sample rate: " << m_settings.m_devSampleRate << "S/s"
<< " Actual sample rate: " << m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim) << "S/s"
<< " BW: " << m_settings.m_bandwidth << "Hz"
<< " img: " << f_img << "Hz"
<< " cut: " << f_cut << "Hz"
<< " img - cut: " << f_img - f_cut;
}
}
}
if (forwardChange)
{
@ -586,15 +597,6 @@ bool BladerfInput::applySettings(const BladeRFInputSettings& settings, bool forc
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
qDebug() << "BladerfInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz"
<< " device sample rate: " << m_settings.m_devSampleRate << "S/s"
<< " Actual sample rate: " << m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim) << "S/s"
<< " BW: " << m_settings.m_bandwidth << "Hz"
<< " img: " << f_img << "Hz"
<< " cut: " << f_cut << "Hz"
<< " img - cut: " << f_img - f_cut;
return true;
}

Wyświetl plik

@ -27,7 +27,7 @@
const PluginDescriptor BlderfInputPlugin::m_pluginDescriptor = {
QString("BladerRF Input"),
QString("3.9.0"),
QString("3.11.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -388,11 +388,12 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
}
}
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) ||
(m_settings.m_LOppmTenths != settings.m_LOppmTenths) ||
(m_settings.m_fcPos != settings.m_fcPos))
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) ||
(m_settings.m_LOppmTenths != settings.m_LOppmTenths) ||
(m_settings.m_log2Decim != settings.m_log2Decim) ||
(m_settings.m_fcPos != settings.m_fcPos) || force)
{
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == HackRFInputSettings::FC_POS_CENTER))
if ((settings.m_log2Decim == 0) || (settings.m_fcPos == HackRFInputSettings::FC_POS_CENTER))
{
deviceCenterFrequency = settings.m_centerFrequency;
f_img = deviceCenterFrequency;

Wyświetl plik

@ -26,12 +26,6 @@
*/
struct LimeSDRInputSettings
{
typedef enum {
FC_POS_INFRA = 0,
FC_POS_SUPRA,
FC_POS_CENTER
} fcPos_t;
enum PathRFE
{
PATH_RFE_NONE = 0,

Wyświetl plik

@ -25,8 +25,7 @@ LimeSDRInputThread::LimeSDRInputThread(lms_stream_t* stream, SampleSinkFifo* sam
m_stream(stream),
m_convertBuffer(LIMESDR_BLOCKSIZE),
m_sampleFifo(sampleFifo),
m_log2Decim(0),
m_fcPos(LimeSDRInputSettings::FC_POS_CENTER)
m_log2Decim(0)
{
}
@ -73,11 +72,6 @@ void LimeSDRInputThread::setLog2Decimation(unsigned int log2_decim)
m_log2Decim = log2_decim;
}
void LimeSDRInputThread::setFcPos(int fcPos)
{
m_fcPos = fcPos;
}
void LimeSDRInputThread::run()
{
int res;
@ -108,90 +102,31 @@ void LimeSDRInputThread::callback(const qint16* buf, qint32 len)
{
SampleVector::iterator it = m_convertBuffer.begin();
if (m_log2Decim == 0)
switch (m_log2Decim)
{
case 0:
m_decimators.decimate1(&it, buf, len);
}
else
{
if (m_fcPos == 0) // Infra
{
switch (m_log2Decim)
{
case 1:
m_decimators.decimate2_inf(&it, buf, len);
break;
case 2:
m_decimators.decimate4_inf(&it, buf, len);
break;
case 3:
m_decimators.decimate8_inf(&it, buf, len);
break;
case 4:
m_decimators.decimate16_inf(&it, buf, len);
break;
case 5:
m_decimators.decimate32_inf(&it, buf, len);
break;
case 6:
m_decimators.decimate64_inf(&it, buf, len);
break;
default:
break;
}
}
else if (m_fcPos == 1) // Supra
{
switch (m_log2Decim)
{
case 1:
m_decimators.decimate2_sup(&it, buf, len);
break;
case 2:
m_decimators.decimate4_sup(&it, buf, len);
break;
case 3:
m_decimators.decimate8_sup(&it, buf, len);
break;
case 4:
m_decimators.decimate16_sup(&it, buf, len);
break;
case 5:
m_decimators.decimate32_sup(&it, buf, len);
break;
case 6:
m_decimators.decimate64_sup(&it, buf, len);
break;
default:
break;
}
}
else if (m_fcPos == 2) // Center
{
switch (m_log2Decim)
{
case 1:
m_decimators.decimate2_cen(&it, buf, len);
break;
case 2:
m_decimators.decimate4_cen(&it, buf, len);
break;
case 3:
m_decimators.decimate8_cen(&it, buf, len);
break;
case 4:
m_decimators.decimate16_cen(&it, buf, len);
break;
case 5:
m_decimators.decimate32_cen(&it, buf, len);
break;
case 6:
m_decimators.decimate64_cen(&it, buf, len);
break;
default:
break;
}
}
break;
case 1:
m_decimators.decimate2_cen(&it, buf, len);
break;
case 2:
m_decimators.decimate4_cen(&it, buf, len);
break;
case 3:
m_decimators.decimate8_cen(&it, buf, len);
break;
case 4:
m_decimators.decimate16_cen(&it, buf, len);
break;
case 5:
m_decimators.decimate32_cen(&it, buf, len);
break;
case 6:
m_decimators.decimate64_cen(&it, buf, len);
break;
default:
break;
}
m_sampleFifo->write(m_convertBuffer.begin(), it);

Wyświetl plik

@ -42,7 +42,6 @@ public:
virtual void setDeviceSampleRate(int sampleRate __attribute__((unused))) {}
virtual bool isRunning() { return m_running; }
void setLog2Decimation(unsigned int log2_decim);
void setFcPos(int fcPos);
private:
QMutex m_startWaitMutex;
@ -55,7 +54,6 @@ private:
SampleSinkFifo* m_sampleFifo;
unsigned int m_log2Decim; // soft decimation
int m_fcPos;
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;

Wyświetl plik

@ -451,17 +451,18 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
std::vector<std::string> params;
bool paramsToSet = false;
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force)
{
qint64 deviceCenterFrequency = settings.m_centerFrequency;
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = settings.m_devSampleRate;
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == PlutoSDRInputSettings::FC_POS_CENTER))
if ((settings.m_log2Decim == 0) || (settings.m_fcPos == PlutoSDRInputSettings::FC_POS_CENTER))
{
f_img = deviceCenterFrequency;
}

Wyświetl plik

@ -28,7 +28,7 @@ class DeviceSourceAPI;
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
QString("PlutoSDR Input"),
QString("3.10.1"),
QString("3.11.1"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -428,7 +428,6 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_log2Decim = settings.m_log2Decim;
forwardChange = true;
if (m_rtlSDRThread != 0)
@ -439,14 +438,16 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
qDebug("RTLSDRInput::applySettings: log2decim set to %d", m_settings.m_log2Decim);
}
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force)
{
m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_transverterMode = settings.m_transverterMode;
m_settings.m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
m_settings.m_log2Decim = settings.m_log2Decim;
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
deviceCenterFrequency -= m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency : 0;
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;

Wyświetl plik

@ -512,31 +512,36 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_log2Decim = settings.m_log2Decim;
forwardChange = true;
if (m_sdrPlayThread != 0)
{
m_sdrPlayThread->setLog2Decimation(m_settings.m_log2Decim);
qDebug() << "SDRPlayInput::applySettings: set decimation to " << (1<<m_settings.m_log2Decim);
qDebug() << "SDRPlayInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
}
}
if (m_settings.m_centerFrequency != settings.m_centerFrequency)
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
forwardChange = true;
if (m_sdrPlayThread != 0)
{
m_sdrPlayThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "SDRPlayInput: set fc pos (enum) to " << (int) settings.m_fcPos;
}
}
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex);
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|| (m_settings.m_fcPos != settings.m_fcPos))
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_LOppmTenths = settings.m_LOppmTenths;
m_settings.m_fcPos = settings.m_fcPos;
m_settings.m_log2Decim = settings.m_log2Decim;
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex);
forwardChange = true;
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == SDRPlaySettings::FC_POS_CENTER))
{
@ -570,17 +575,6 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
}
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
m_settings.m_fcPos = settings.m_fcPos;
if (m_sdrPlayThread != 0)
{
m_sdrPlayThread->setFcPos((int) m_settings.m_fcPos);
qDebug() << "SDRPlayInput: set fc pos (enum) to " << (int) m_settings.m_fcPos;
}
}
if ((m_settings.m_frequencyBandIndex != settings.m_frequencyBandIndex) || force)
{
m_settings.m_frequencyBandIndex = settings.m_frequencyBandIndex;

Wyświetl plik

@ -25,7 +25,7 @@
const PluginDescriptor SDRPlayPlugin::m_pluginDescriptor = {
QString("SDRPlay RSP1 Input"),
QString("3.9.0"),
QString("3.11.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -250,36 +250,34 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_frequencyShift != settings.m_frequencyShift))
|| (m_settings.m_frequencyShift != settings.m_frequencyShift)
|| (m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
qint64 deviceCenterFrequency = settings.m_centerFrequency;
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
qint64 f_img = 0;
qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = settings.m_sampleRate;
if ((settings.m_log2Decim == 0) || (settings.m_fcPos == TestSourceSettings::FC_POS_CENTER))
{
f_img = 0;
}
else
if (settings.m_log2Decim != 0)
{
if (settings.m_fcPos == TestSourceSettings::FC_POS_INFRA)
{
deviceCenterFrequency += (devSampleRate / 4);
f_img = devSampleRate/2;
f_img = deviceCenterFrequency + devSampleRate/2;
}
else if (settings.m_fcPos == TestSourceSettings::FC_POS_SUPRA)
{
deviceCenterFrequency -= (devSampleRate / 4);
f_img = devSampleRate/2;
f_img = deviceCenterFrequency - devSampleRate/2;
}
}
if (m_testSourceThread != 0)
{
m_testSourceThread->setFcPos((int) settings.m_fcPos);
m_testSourceThread->setFrequencyShift(f_img + settings.m_frequencyShift);
qDebug() << "TestSourceInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz"
m_testSourceThread->setFrequencyShift(deviceCenterFrequency - settings.m_centerFrequency + settings.m_frequencyShift);
qDebug() << "TestSourceInput::applySettings:"
<< " center freq: " << settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz"
<< " device sample rate: " << devSampleRate << "Hz"
<< " Actual sample rate: " << devSampleRate/(1<<m_settings.m_log2Decim) << "Hz"