1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

AirspyHF: Removed Fc position control

This commit is contained in:
f4exb 2018-01-14 21:37:49 +01:00
parent 6384c88f8b
commit f0861c1bb5
8 changed files with 62 additions and 241 deletions

View File

@ -219,7 +219,6 @@ void AirspyHFGui::displaySettings()
ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
blockApplySettings(false);
}
@ -277,20 +276,6 @@ void AirspyHFGui::on_decim_currentIndexChanged(int index)
sendSettings();
}
void AirspyHFGui::on_fcPos_currentIndexChanged(int index)
{
if (index == 0) {
m_settings.m_fcPos = AirspyHFSettings::FC_POS_INFRA;
sendSettings();
} else if (index == 1) {
m_settings.m_fcPos = AirspyHFSettings::FC_POS_SUPRA;
sendSettings();
} else if (index == 2) {
m_settings.m_fcPos = AirspyHFSettings::FC_POS_CENTER;
sendSettings();
}
}
void AirspyHFGui::on_startStop_toggled(bool checked)
{
if (m_doApplySettings)

View File

@ -79,7 +79,6 @@ private slots:
void on_centerFrequency_changed(quint64 value);
void on_sampleRate_currentIndexChanged(int index);
void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_transverter_clicked();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>324</width>
<height>180</height>
<height>120</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,7 +19,7 @@
<property name="minimumSize">
<size>
<width>320</width>
<height>180</height>
<height>120</height>
</size>
</property>
<property name="font">
@ -180,44 +180,15 @@
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_corr">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="bandLabel">
<property name="text">
<string>Band</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="fcPosRightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<widget class="TransverterButton" name="transverter">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Transverter frequency translation dialog</string>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QComboBox" name="band">
<property name="maximumSize">
<size>
@ -240,14 +211,7 @@
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_samplerate">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<item>
<widget class="QLabel" name="sampleRateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@ -256,11 +220,11 @@
</sizepolicy>
</property>
<property name="text">
<string>Rate</string>
<string>S/R</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QComboBox" name="sampleRate">
<property name="minimumSize">
<size>
@ -284,28 +248,34 @@
</item>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="0" column="2">
<item>
<widget class="QLabel" name="rateLabel">
<property name="text">
<string>k</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="label_fcPos">
<item>
<spacer name="fcPosRightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Fp</string>
<string>Dec</string>
</property>
</widget>
</item>
<item row="0" column="5">
<item>
<widget class="QComboBox" name="decim">
<property name="maximumSize">
<size>
@ -356,50 +326,22 @@
</item>
</widget>
</item>
<item row="0" column="7">
<widget class="QComboBox" name="fcPos">
<item>
<widget class="TransverterButton" name="transverter">
<property name="maximumSize">
<size>
<width>55</width>
<height>16777215</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Relative position of device center frequency</string>
<string>Transverter frequency translation dialog</string>
</property>
<property name="currentIndex">
<number>2</number>
<property name="text">
<string>X</string>
</property>
<item>
<property name="text">
<string>Inf</string>
</property>
</item>
<item>
<property name="text">
<string>Sup</string>
</property>
</item>
<item>
<property name="text">
<string>Cen</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>

View File

@ -163,7 +163,6 @@ bool AirspyHFInput::start()
m_airspyHFThread->setSamplerate(m_sampleRates[m_settings.m_devSampleRateIndex]);
m_airspyHFThread->setLog2Decimation(m_settings.m_log2Decim);
m_airspyHFThread->setFcPos((int) m_settings.m_fcPos);
m_airspyHFThread->startWork();
@ -386,7 +385,6 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
}
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))
{
@ -396,24 +394,6 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = m_sampleRates[sampleRateIndex];
if ((settings.m_log2Decim == 0) || (settings.m_fcPos == AirspyHFSettings::FC_POS_CENTER))
{
f_img = deviceCenterFrequency;
}
else
{
if (settings.m_fcPos == AirspyHFSettings::FC_POS_INFRA)
{
deviceCenterFrequency += (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2;
}
else if (settings.m_fcPos == AirspyHFSettings::FC_POS_SUPRA)
{
deviceCenterFrequency -= (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2;
}
}
if (m_dev != 0)
{
setDeviceCenterFrequency(deviceCenterFrequency, settings);
@ -428,15 +408,6 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
forwardChange = true;
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
if (m_airspyHFThread != 0)
{
m_airspyHFThread->setFcPos((int) settings.m_fcPos);
qDebug() << "AirspyInput: set fc pos (enum) to " << (int) settings.m_fcPos;
}
}
if (forwardChange)
{
int sampleRate = m_sampleRates[sampleRateIndex]/(1<<settings.m_log2Decim);

View File

@ -28,7 +28,6 @@ void AirspyHFSettings::resetToDefaults()
m_centerFrequency = 7150*1000;
m_devSampleRateIndex = 0;
m_log2Decim = 0;
m_fcPos = FC_POS_CENTER;
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_bandIndex = 0;
@ -40,7 +39,6 @@ QByteArray AirspyHFSettings::serialize() const
s.writeU32(1, m_devSampleRateIndex);
s.writeU32(3, m_log2Decim);
s.writeS32(4, m_fcPos);
s.writeBool(7, m_transverterMode);
s.writeS64(8, m_transverterDeltaFrequency);
s.writeU32(9, m_bandIndex);
@ -66,7 +64,6 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
d.readU32(1, &m_devSampleRateIndex, 0);
d.readU32(3, &m_log2Decim, 0);
d.readS32(4, &intval, 0);
m_fcPos = (fcPos_t) intval;
d.readBool(7, &m_transverterMode, false);
d.readS64(8, &m_transverterDeltaFrequency, 0);
d.readU32(9, &uintval, 0);

View File

@ -17,17 +17,11 @@
#ifndef _AIRSPYHF_AIRSPYHFSETTINGS_H_
#define _AIRSPYHF_AIRSPYHFSETTINGS_H_
struct AirspyHFSettings {
typedef enum {
FC_POS_INFRA = 0,
FC_POS_SUPRA,
FC_POS_CENTER
} fcPos_t;
struct AirspyHFSettings
{
quint64 m_centerFrequency;
quint32 m_devSampleRateIndex;
quint32 m_log2Decim;
fcPos_t m_fcPos;
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
quint32 m_bandIndex;

View File

@ -30,8 +30,7 @@ AirspyHFThread::AirspyHFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFif
m_convertBuffer(AIRSPYHF_BLOCKSIZE),
m_sampleFifo(sampleFifo),
m_samplerate(10),
m_log2Decim(0),
m_fcPos(0)
m_log2Decim(0)
{
m_this = this;
}
@ -68,11 +67,6 @@ void AirspyHFThread::setLog2Decimation(unsigned int log2_decim)
m_log2Decim = log2_decim;
}
void AirspyHFThread::setFcPos(int fcPos)
{
m_fcPos = fcPos;
}
void AirspyHFThread::run()
{
airspyhf_error rc;
@ -110,91 +104,32 @@ void AirspyHFThread::callback(const qint16* buf, qint32 len)
{
SampleVector::iterator it = m_convertBuffer.begin();
if (m_log2Decim == 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;
}
}
}
switch (m_log2Decim)
{
case 0:
m_decimators.decimate1(&it, buf, len);
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);
}

View File

@ -38,7 +38,6 @@ public:
void stopWork();
void setSamplerate(uint32_t samplerate);
void setLog2Decimation(unsigned int log2_decim);
void setFcPos(int fcPos);
private:
QMutex m_startWaitMutex;
@ -52,7 +51,6 @@ private:
int m_samplerate;
unsigned int m_log2Decim;
int m_fcPos;
static AirspyHFThread *m_this;
Decimators<qint16, SDR_SAMP_SZ, 16> m_decimators;