mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-26 20:14:19 -04:00
HackRF output: implementation of Fc position selection in the GUI
This commit is contained in:
@@ -335,6 +335,7 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
<< " m_bandwidth: " << settings.m_bandwidth
|
||||
<< " m_devSampleRate: " << settings.m_devSampleRate
|
||||
<< " m_log2Interp: " << settings.m_log2Interp
|
||||
<< " m_fcPos: " << settings.m_fcPos
|
||||
<< " m_biasT: " << settings.m_biasT
|
||||
<< " m_lnaExt: " << settings.m_lnaExt
|
||||
<< " m_vgaGain: " << settings.m_vgaGain
|
||||
@@ -434,6 +435,13 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
forwardChange = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
|
||||
{
|
||||
if (m_hackRFThread != 0) {
|
||||
m_hackRFThread->setFcPos((int) settings.m_fcPos);
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_settings.m_vgaGain != settings.m_vgaGain) || force)
|
||||
{
|
||||
reverseAPIKeys.append("vgaGain");
|
||||
|
||||
@@ -298,6 +298,12 @@ void HackRFOutputGui::on_interp_currentIndexChanged(int index)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void HackRFOutputGui::on_fcPos_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_fcPos = (HackRFOutputSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index);
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void HackRFOutputGui::on_txvga_valueChanged(int value)
|
||||
{
|
||||
if ((value < 0) || (value > 47))
|
||||
|
||||
@@ -89,6 +89,7 @@ private slots:
|
||||
void on_LOppm_valueChanged(int value);
|
||||
void on_biasT_stateChanged(int state);
|
||||
void on_interp_currentIndexChanged(int index);
|
||||
void on_fcPos_currentIndexChanged(int index);
|
||||
void on_lnaExt_stateChanged(int state);
|
||||
void on_bbFilter_currentIndexChanged(int index);
|
||||
void on_txvga_valueChanged(int value);
|
||||
|
||||
@@ -349,6 +349,41 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fcPosLabel">
|
||||
<property name="text">
|
||||
<string>Fc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="fcPos">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Relative position of device center frequency</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>
|
||||
<widget class="QLabel" name="label_interp">
|
||||
<property name="text">
|
||||
|
||||
@@ -31,6 +31,7 @@ void HackRFOutputSettings::resetToDefaults()
|
||||
m_LOppmTenths = 0;
|
||||
m_biasT = false;
|
||||
m_log2Interp = 0;
|
||||
m_fcPos = FC_POS_CENTER;
|
||||
m_lnaExt = false;
|
||||
m_vgaGain = 22;
|
||||
m_bandwidth = 1750000;
|
||||
@@ -46,6 +47,7 @@ QByteArray HackRFOutputSettings::serialize() const
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeS32(1, m_LOppmTenths);
|
||||
s.writeS32(2, (int) m_fcPos);
|
||||
s.writeBool(3, m_biasT);
|
||||
s.writeU32(4, m_log2Interp);
|
||||
s.writeBool(5, m_lnaExt);
|
||||
@@ -73,8 +75,11 @@ bool HackRFOutputSettings::deserialize(const QByteArray& data)
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
uint32_t uintval;
|
||||
int32_t intval;
|
||||
|
||||
d.readS32(1, &m_LOppmTenths, 0);
|
||||
d.readS32(2, &intval, 2);
|
||||
m_fcPos = (fcPos_t) (intval < 0 ? 0 : intval > 2 ? 2 : intval);
|
||||
d.readBool(3, &m_biasT, false);
|
||||
d.readU32(4, &m_log2Interp, 0);
|
||||
d.readBool(5, &m_lnaExt, false);
|
||||
|
||||
@@ -21,11 +21,18 @@
|
||||
#include <QString>
|
||||
|
||||
struct HackRFOutputSettings {
|
||||
typedef enum {
|
||||
FC_POS_INFRA = 0,
|
||||
FC_POS_SUPRA,
|
||||
FC_POS_CENTER
|
||||
} fcPos_t;
|
||||
|
||||
quint64 m_centerFrequency;
|
||||
qint32 m_LOppmTenths;
|
||||
quint32 m_bandwidth;
|
||||
quint32 m_vgaGain;
|
||||
quint32 m_log2Interp;
|
||||
fcPos_t m_fcPos;
|
||||
quint64 m_devSampleRate;
|
||||
bool m_biasT;
|
||||
bool m_lnaExt;
|
||||
|
||||
@@ -58,6 +58,11 @@ void HackRFOutputThread::setLog2Interpolation(unsigned int log2Interp)
|
||||
m_log2Interp = log2Interp;
|
||||
}
|
||||
|
||||
void HackRFOutputThread::setFcPos(int fcPos)
|
||||
{
|
||||
m_fcPos = fcPos;
|
||||
}
|
||||
|
||||
void HackRFOutputThread::run()
|
||||
{
|
||||
hackrf_error rc;
|
||||
@@ -121,28 +126,83 @@ void HackRFOutputThread::callback(qint8* buf, qint32 len)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_log2Interp)
|
||||
if (m_fcPos == 0) // Infra
|
||||
{
|
||||
switch (m_log2Interp)
|
||||
{
|
||||
case 1:
|
||||
m_interpolators.interpolate2_inf(&beginRead, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_interpolators.interpolate4_inf(&beginRead, buf, len);
|
||||
break;
|
||||
// case 3:
|
||||
// m_interpolators.interpolate8_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
// case 4:
|
||||
// m_interpolators.interpolate16_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
// case 5:
|
||||
// m_interpolators.interpolate32_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
// case 6:
|
||||
// m_interpolators.interpolate64_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 1) // Supra
|
||||
{
|
||||
case 1:
|
||||
m_interpolators.interpolate2_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_interpolators.interpolate4_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_interpolators.interpolate8_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_interpolators.interpolate16_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_interpolators.interpolate32_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_interpolators.interpolate64_cen(&beginRead, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (m_log2Interp)
|
||||
{
|
||||
case 1:
|
||||
m_interpolators.interpolate2_sup(&beginRead, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_interpolators.interpolate4_sup(&beginRead, buf, len);
|
||||
break;
|
||||
// case 3:
|
||||
// m_interpolators.interpolate8_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
// case 4:
|
||||
// m_interpolators.interpolate16_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
// case 5:
|
||||
// m_interpolators.interpolate32_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
// case 6:
|
||||
// m_interpolators.interpolate64_cen(&beginRead, buf, len);
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (m_fcPos == 2) // Center
|
||||
{
|
||||
switch (m_log2Interp)
|
||||
{
|
||||
case 1:
|
||||
m_interpolators.interpolate2_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 2:
|
||||
m_interpolators.interpolate4_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 3:
|
||||
m_interpolators.interpolate8_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 4:
|
||||
m_interpolators.interpolate16_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 5:
|
||||
m_interpolators.interpolate32_cen(&beginRead, buf, len);
|
||||
break;
|
||||
case 6:
|
||||
m_interpolators.interpolate64_cen(&beginRead, buf, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
void startWork();
|
||||
void stopWork();
|
||||
void setLog2Interpolation(unsigned int log2_interp);
|
||||
void setFcPos(int fcPos);
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
@@ -48,6 +49,7 @@ private:
|
||||
SampleSourceFifo* m_sampleFifo;
|
||||
|
||||
unsigned int m_log2Interp;
|
||||
int m_fcPos;
|
||||
|
||||
Interpolators<qint8, SDR_TX_SAMP_SZ, 8> m_interpolators;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user