1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Deep redesign: Better support for FCD dongles #12: finalized support of FCD Pro

This commit is contained in:
f4exb 2015-09-08 01:27:18 +02:00
parent ddd6fb539c
commit f23a115c23
7 changed files with 125 additions and 124 deletions

View File

@ -179,7 +179,6 @@ bool FCDProGui::handleMessage(const Message& message)
void FCDProGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.centerFrequency / 1000);
ui->checkBoxB->setChecked(m_settings.biasT);
ui->ppm->setValue(m_settings.LOppmTenths);
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.LOppmTenths/10.0, 'f', 1)));
@ -220,20 +219,6 @@ void FCDProGui::on_ppm_valueChanged(int value)
sendSettings();
}
void FCDProGui::on_checkBoxB_stateChanged(int state)
{
if (state == Qt::Checked)
{
m_settings.biasT = 1;
}
else
{
m_settings.biasT = 0;
}
sendSettings();
}
void FCDProGui::on_lnaGain_currentIndexChanged(int index)
{
m_settings.lnaGainIndex = index;
@ -330,6 +315,27 @@ void FCDProGui::on_gain6_currentIndexChanged(int index)
sendSettings();
}
void FCDProGui::on_setDefaults_clicked(bool checked)
{
m_settings.lnaGainIndex = 4;
//m_settings.rfFilterIndex = 0;
m_settings.mixerGainIndex = 1;
m_settings.mixerFilterIndex = 8;
m_settings.gain1Index = 1;
m_settings.rcFilterIndex = 15;
m_settings.gain2Index = 1;
m_settings.gain3Index = 1;
m_settings.gain4Index = 0;
m_settings.ifFilterIndex = 31;
m_settings.gain5Index = 0;
m_settings.gain6Index = 0;
m_settings.lnaEnhanceIndex = 0;
m_settings.biasCurrentIndex = 3;
m_settings.modeIndex = 0;
displaySettings();
sendSettings();
}
void FCDProGui::updateHardware()
{
FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings);

View File

@ -45,7 +45,6 @@ private:
private slots:
void on_centerFrequency_changed(quint64 value);
void on_ppm_valueChanged(int value);
void on_checkBoxB_stateChanged(int state);
// TOOD: defaults push button
void on_lnaGain_currentIndexChanged(int index);
void on_rfFilter_currentIndexChanged(int index);
@ -63,6 +62,7 @@ private slots:
void on_ifFilter_currentIndexChanged(int index);
void on_gain5_currentIndexChanged(int index);
void on_gain6_currentIndexChanged(int index);
void on_setDefaults_clicked(bool checked);
void updateHardware();
};

View File

@ -115,10 +115,10 @@
<string>LO ppm correction</string>
</property>
<property name="minimum">
<number>-1000</number>
<number>-2000</number>
</property>
<property name="maximum">
<number>1000</number>
<number>2000</number>
</property>
<property name="pageStep">
<number>1</number>
@ -140,14 +140,7 @@
<item>
<layout class="QHBoxLayout" name="layoutBiasT">
<item>
<widget class="QCheckBox" name="checkBoxB">
<property name="text">
<string>Bias T</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="defaultsButton">
<widget class="QPushButton" name="setDefaults">
<property name="text">
<string>Defaults</string>
</property>
@ -155,30 +148,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutLNA">
<item>
<widget class="QLabel" name="lnaGainLabel">
<property name="text">
<string>LNA G</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="lnaGain"/>
</item>
<item>
<widget class="QLabel" name="rfFilterLabel">
<property name="text">
<string>RF filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rfFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutBand">
<item>
@ -203,30 +172,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutMixer">
<item>
<widget class="QLabel" name="mixGainLabel">
<property name="text">
<string>Mix G</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mixGain"/>
</item>
<item>
<widget class="QLabel" name="mixFilterLabel">
<property name="text">
<string>Mix filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mixFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutBias">
<item>
@ -251,6 +196,54 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutLNA">
<item>
<widget class="QLabel" name="lnaGainLabel">
<property name="text">
<string>LNA G</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="lnaGain"/>
</item>
<item>
<widget class="QLabel" name="rfFilterLabel">
<property name="text">
<string>RF filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rfFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutMixer">
<item>
<widget class="QLabel" name="mixGainLabel">
<property name="text">
<string>Mix G</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mixGain"/>
</item>
<item>
<widget class="QLabel" name="mixFilterLabel">
<property name="text">
<string>Mix filt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mixFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layoutGain1">
<item>

View File

@ -40,7 +40,6 @@ void FCDProInput::Settings::resetToDefaults()
{
centerFrequency = 435000000;
LOppmTenths = 0;
biasT = 0;
lnaGainIndex = 0;
rfFilterIndex = 0;
lnaEnhanceIndex = 0;
@ -65,7 +64,6 @@ QByteArray FCDProInput::Settings::serialize() const
data.m_data.m_frequency = centerFrequency;
data.m_LOppmTenths = LOppmTenths;
data.m_biasT = biasT;
data.m_lnaGainIndex = lnaGainIndex;
data.m_rfFilterIndex = rfFilterIndex;
data.m_lnaEnhanceIndex = lnaEnhanceIndex;
@ -98,12 +96,12 @@ bool FCDProInput::Settings::deserialize(const QByteArray& serializedData)
centerFrequency = data.m_data.m_frequency;
LOppmTenths = data.m_LOppmTenths;
biasT = data.m_biasT;
lnaGainIndex = data.m_lnaGainIndex;
rfFilterIndex = data.m_rfFilterIndex;
lnaEnhanceIndex = data.m_lnaEnhanceIndex;
bandIndex = data.m_bandIndex;
mixerGainIndex = data.m_mixerGainIndex;
mixerFilterIndex = data.m_mixerFilterIndex;
biasCurrentIndex = data.m_biasCurrentIndex;
modeIndex = data.m_modeIndex;
gain1Index = data.m_gain1Index;
@ -246,16 +244,6 @@ void FCDProInput::applySettings(const Settings& settings, bool force)
signalChange = true;
}
if ((m_settings.biasT != settings.biasT) || force)
{
m_settings.biasT = settings.biasT;
if (m_dev != 0)
{
set_bias_t(settings.biasT > 0);
}
}
if ((m_settings.lnaGainIndex != settings.lnaGainIndex) || force)
{
m_settings.lnaGainIndex = settings.lnaGainIndex;
@ -416,6 +404,16 @@ void FCDProInput::applySettings(const Settings& settings, bool force)
}
}
if ((m_settings.LOppmTenths != settings.LOppmTenths) || force)
{
m_settings.LOppmTenths = settings.LOppmTenths;
if (m_dev != 0)
{
set_lo_ppm();
}
}
if (signalChange)
{
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.centerFrequency);
@ -425,10 +423,13 @@ void FCDProInput::applySettings(const Settings& settings, bool force)
void FCDProInput::set_center_freq(double freq)
{
freq += freq*(((double) m_settings.LOppmTenths)/10000000.0);
if (fcdAppSetFreq(m_dev, freq) == FCD_MODE_NONE)
{
qDebug("No FCD HID found for frquency change");
}
}
void FCDProInput::set_bias_t(bool on)
@ -679,3 +680,8 @@ void FCDProInput::set_gain6(int index)
qWarning() << "FCDProPlusInput::set_gain6: failed to set at " << cmd_value;
}
}
void FCDProInput::set_lo_ppm()
{
set_center_freq((double) m_settings.centerFrequency);
}

View File

@ -36,7 +36,6 @@ public:
Settings();
quint64 centerFrequency;
qint32 LOppmTenths;
bool biasT;
qint32 lnaGainIndex;
qint32 rfFilterIndex;
qint32 lnaEnhanceIndex;
@ -112,6 +111,7 @@ public:
private:
void applySettings(const Settings& settings, bool force);
void set_lo_ppm();
hid_device *m_dev;
QMutex m_mutex;

View File

@ -25,23 +25,22 @@ void FCDProSerializer::writeSerializedData(const FCDData& data, QByteArray& seri
s.writeBlob(1, sampleSourceSerialized);
s.writeS32(2, data.m_LOppmTenths);
s.writeBool(3, data.m_biasT);
s.writeS32(4, data.m_lnaGainIndex);
s.writeS32(5, data.m_rfFilterIndex);
s.writeS32(6, data.m_lnaEnhanceIndex);
s.writeS32(7, data.m_bandIndex);
s.writeS32(8, data.m_mixerGainIndex);
s.writeS32(9, data.m_mixerFilterIndex);
s.writeS32(10, data.m_biasCurrentIndex);
s.writeS32(11, data.m_modeIndex);
s.writeS32(12, data.m_gain1Index);
s.writeS32(13, data.m_rcFilterIndex);
s.writeS32(14, data.m_gain2Index);
s.writeS32(15, data.m_gain3Index);
s.writeS32(16, data.m_gain4Index);
s.writeS32(17, data.m_ifFilterIndex);
s.writeS32(18, data.m_gain5Index);
s.writeS32(19, data.m_gain6Index);
s.writeS32(3, data.m_lnaGainIndex);
s.writeS32(4, data.m_rfFilterIndex);
s.writeS32(5, data.m_lnaEnhanceIndex);
s.writeS32(6, data.m_bandIndex);
s.writeS32(7, data.m_mixerGainIndex);
s.writeS32(8, data.m_mixerFilterIndex);
s.writeS32(9, data.m_biasCurrentIndex);
s.writeS32(10, data.m_modeIndex);
s.writeS32(11, data.m_gain1Index);
s.writeS32(12, data.m_rcFilterIndex);
s.writeS32(13, data.m_gain2Index);
s.writeS32(14, data.m_gain3Index);
s.writeS32(15, data.m_gain4Index);
s.writeS32(16, data.m_ifFilterIndex);
s.writeS32(17, data.m_gain5Index);
s.writeS32(18, data.m_gain6Index);
serializedData = s.final();
}
@ -66,23 +65,22 @@ bool FCDProSerializer::readSerializedData(const QByteArray& serializedData, FCDD
d.readBlob(1, &sampleSourceSerialized);
d.readS32(2, &data.m_LOppmTenths);
d.readBool(3, &data.m_biasT);
d.readS32(4, &data.m_lnaGainIndex);
d.readS32(5, &data.m_rfFilterIndex);
d.readS32(6, &data.m_lnaEnhanceIndex);
d.readS32(7, &data.m_bandIndex);
d.readS32(8, &data.m_mixerGainIndex);
d.readS32(9, &data.m_mixerFilterIndex);
d.readS32(10, &data.m_biasCurrentIndex);
d.readS32(11, &data.m_modeIndex);
d.readS32(12, &data.m_gain1Index);
d.readS32(13, &data.m_rcFilterIndex);
d.readS32(14, &data.m_gain2Index);
d.readS32(15, &data.m_gain3Index);
d.readS32(16, &data.m_gain4Index);
d.readS32(17, &data.m_ifFilterIndex);
d.readS32(18, &data.m_gain5Index);
d.readS32(19, &data.m_gain6Index);
d.readS32(3, &data.m_lnaGainIndex);
d.readS32(4, &data.m_rfFilterIndex);
d.readS32(5, &data.m_lnaEnhanceIndex);
d.readS32(6, &data.m_bandIndex);
d.readS32(7, &data.m_mixerGainIndex);
d.readS32(8, &data.m_mixerFilterIndex);
d.readS32(9, &data.m_biasCurrentIndex);
d.readS32(10, &data.m_modeIndex);
d.readS32(11, &data.m_gain1Index);
d.readS32(12, &data.m_rcFilterIndex);
d.readS32(13, &data.m_gain2Index);
d.readS32(14, &data.m_gain3Index);
d.readS32(15, &data.m_gain4Index);
d.readS32(16, &data.m_ifFilterIndex);
d.readS32(17, &data.m_gain5Index);
d.readS32(18, &data.m_gain6Index);
return SampleSourceSerializer::readSerializedData(sampleSourceSerialized, data.m_data);
}
@ -96,7 +94,6 @@ bool FCDProSerializer::readSerializedData(const QByteArray& serializedData, FCDD
void FCDProSerializer::setDefaults(FCDData& data)
{
data.m_LOppmTenths = 0;
data.m_biasT = false;
data.m_lnaGainIndex = 0;
data.m_rfFilterIndex = 0;
data.m_lnaEnhanceIndex = 0;

View File

@ -26,7 +26,6 @@ public:
{
SampleSourceSerializer::Data m_data;
qint32 m_LOppmTenths;
bool m_biasT;
qint32 m_lnaGainIndex;
qint32 m_rfFilterIndex;
qint32 m_lnaEnhanceIndex;