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

Deep redesign: Better support for FCD dongles #11: Proper support of FCD Pro

This commit is contained in:
f4exb 2015-09-07 05:35:01 +02:00
parent cf68879962
commit 1f4894364d
4 changed files with 311 additions and 18 deletions

View File

@ -3,6 +3,7 @@
#include "gui/colormapper.h"
#include "dsp/dspengine.h"
#include "fcdprogui.h"
#include "fcdproconst.h"
FCDProGui::FCDProGui(PluginAPI* pluginAPI, QWidget* parent) :
QWidget(parent),
@ -14,6 +15,103 @@ FCDProGui::FCDProGui(PluginAPI* pluginAPI, QWidget* parent) :
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 64000U, 1700000U);
ui->lnaGain->clear();
for (int i = 0; i < FCDProConstants::fcdpro_lna_gain_nb_values(); i++)
{
ui->lnaGain->addItem(QString(FCDProConstants::lna_gains[i].label.c_str()), i);
}
ui->rfFilter->clear();
for (int i = 0; i < FCDProConstants::fcdpro_rf_filter_nb_values(); i++)
{
ui->rfFilter->addItem(QString(FCDProConstants::rf_filters[i].label.c_str()), i);
}
ui->lnaEnhance->clear();
for (int i = 0; i < FCDProConstants::fcdpro_lna_enhance_nb_values(); i++)
{
ui->lnaEnhance->addItem(QString(FCDProConstants::lna_enhances[i].label.c_str()), i);
}
ui->band->clear();
for (int i = 0; i < FCDProConstants::fcdpro_band_nb_values(); i++)
{
ui->band->addItem(QString(FCDProConstants::bands[i].label.c_str()), i);
}
ui->mixGain->clear();
for (int i = 0; i < FCDProConstants::fcdpro_mixer_gain_nb_values(); i++)
{
ui->mixGain->addItem(QString(FCDProConstants::mixer_gains[i].label.c_str()), i);
}
ui->mixFilter->clear();
for (int i = 0; i < FCDProConstants::fcdpro_mixer_filter_nb_values(); i++)
{
ui->mixFilter->addItem(QString(FCDProConstants::mixer_filters[i].label.c_str()), i);
}
ui->bias->clear();
for (int i = 0; i < FCDProConstants::fcdpro_bias_current_nb_values(); i++)
{
ui->bias->addItem(QString(FCDProConstants::bias_currents[i].label.c_str()), i);
}
ui->mode->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain_mode_nb_values(); i++)
{
ui->mode->addItem(QString(FCDProConstants::if_gain_modes[i].label.c_str()), i);
}
ui->gain1->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain1_nb_values(); i++)
{
ui->gain1->addItem(QString(FCDProConstants::if_gains1[i].label.c_str()), i);
}
ui->rcFilter->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_rc_filter_nb_values(); i++)
{
ui->rcFilter->addItem(QString(FCDProConstants::if_rc_filters[i].label.c_str()), i);
}
ui->gain2->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain2_nb_values(); i++)
{
ui->gain2->addItem(QString(FCDProConstants::if_gains2[i].label.c_str()), i);
}
ui->gain3->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain3_nb_values(); i++)
{
ui->gain3->addItem(QString(FCDProConstants::if_gains3[i].label.c_str()), i);
}
ui->gain4->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain4_nb_values(); i++)
{
ui->gain4->addItem(QString(FCDProConstants::if_gains4[i].label.c_str()), i);
}
ui->ifFilter->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_filter_nb_values(); i++)
{
ui->ifFilter->addItem(QString(FCDProConstants::if_filters[i].label.c_str()), i);
}
ui->gain5->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain5_nb_values(); i++)
{
ui->gain5->addItem(QString(FCDProConstants::if_gains5[i].label.c_str()), i);
}
ui->gain6->clear();
for (int i = 0; i < FCDProConstants::fcdpro_if_gain6_nb_values(); i++)
{
ui->gain6->addItem(QString(FCDProConstants::if_gains6[i].label.c_str()), i);
}
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
displaySettings();
@ -82,6 +180,25 @@ 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)));
ui->lnaGain->setCurrentIndex(m_settings.lnaGainIndex);
ui->rfFilter->setCurrentIndex(m_settings.rfFilterIndex);
ui->lnaEnhance->setCurrentIndex(m_settings.lnaEnhanceIndex);
ui->band->setCurrentIndex(m_settings.bandIndex);
ui->mixGain->setCurrentIndex(m_settings.mixerGainIndex);
ui->mixFilter->setCurrentIndex(m_settings.mixerFilterIndex);
ui->bias->setCurrentIndex(m_settings.biasCurrentIndex);
ui->mode->setCurrentIndex(m_settings.modeIndex);
ui->gain1->setCurrentIndex(m_settings.gain1Index);
ui->gain2->setCurrentIndex(m_settings.gain2Index);
ui->gain3->setCurrentIndex(m_settings.gain3Index);
ui->gain4->setCurrentIndex(m_settings.gain4Index);
ui->gain5->setCurrentIndex(m_settings.gain5Index);
ui->gain6->setCurrentIndex(m_settings.gain6Index);
ui->rcFilter->setCurrentIndex(m_settings.rcFilterIndex);
ui->ifFilter->setCurrentIndex(m_settings.ifFilterIndex);
}
void FCDProGui::sendSettings()
@ -119,82 +236,98 @@ void FCDProGui::on_checkBoxB_stateChanged(int state)
void FCDProGui::on_lnaGain_currentIndexChanged(int index)
{
m_settings.lnaGainIndex = index;
sendSettings();
}
void FCDProGui::on_rfFilter_currentIndexChanged(int index)
{
m_settings.rfFilterIndex = index;
sendSettings();
}
void FCDProGui::on_lnaEnhance_currentIndexChanged(int index)
{
m_settings.lnaEnhanceIndex = index;
sendSettings();
}
void FCDProGui::on_band_currentIndexChanged(int index)
{
m_settings.bandIndex = index;
sendSettings();
}
void FCDProGui::on_mixGain_currentIndexChanged(int index)
{
m_settings.mixerGainIndex = index;
sendSettings();
}
void FCDProGui::on_mixFilter_currentIndexChanged(int index)
{
m_settings.mixerFilterIndex = index;
sendSettings();
}
void FCDProGui::on_bias_currentIndexChanged(int index)
{
m_settings.biasCurrentIndex = index;
sendSettings();
}
void FCDProGui::on_mode_currentIndexChanged(int index)
{
m_settings.modeIndex = index;
sendSettings();
}
void FCDProGui::on_gain1_currentIndexChanged(int index)
{
m_settings.gain1Index = index;
sendSettings();
}
void FCDProGui::on_rcFilter_currentIndexChanged(int index)
{
m_settings.rcFilterIndex = index;
sendSettings();
}
void FCDProGui::on_gain2_currentIndexChanged(int index)
{
m_settings.gain2Index = index;
sendSettings();
}
void FCDProGui::on_gain3_currentIndexChanged(int index)
{
m_settings.gain3Index = index;
sendSettings();
}
void FCDProGui::on_gain4_currentIndexChanged(int index)
{
m_settings.gain4Index = index;
sendSettings();
}
void FCDProGui::on_ifFilter_currentIndexChanged(int index)
{
m_settings.ifFilterIndex = index;
sendSettings();
}
void FCDProGui::on_gain5_currentIndexChanged(int index)
{
m_settings.gain5Index = index;
sendSettings();
}
void FCDProGui::on_gain6_currentIndexChanged(int index)
{
m_settings.gain6Index = index;
sendSettings();
}
void FCDProGui::updateHardware()

View File

@ -129,7 +129,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="ppmText">
<property name="text">
<string>0.0</string>
</property>

View File

@ -256,6 +256,166 @@ void FCDProInput::applySettings(const Settings& settings, bool force)
}
}
if ((m_settings.lnaGainIndex != settings.lnaGainIndex) || force)
{
m_settings.lnaGainIndex = settings.lnaGainIndex;
if (m_dev != 0)
{
set_ifFilter(settings.lnaGainIndex);
}
}
if ((m_settings.rfFilterIndex != settings.rfFilterIndex) || force)
{
m_settings.rfFilterIndex = settings.rfFilterIndex;
if (m_dev != 0)
{
set_rfFilter(settings.rfFilterIndex);
}
}
if ((m_settings.lnaEnhanceIndex != settings.lnaEnhanceIndex) || force)
{
m_settings.lnaEnhanceIndex = settings.lnaEnhanceIndex;
if (m_dev != 0)
{
set_lnaEnhance(settings.lnaEnhanceIndex);
}
}
if ((m_settings.bandIndex != settings.bandIndex) || force)
{
m_settings.bandIndex = settings.bandIndex;
if (m_dev != 0)
{
set_band(settings.bandIndex);
}
}
if ((m_settings.mixerGainIndex != settings.mixerGainIndex) || force)
{
m_settings.mixerGainIndex = settings.mixerGainIndex;
if (m_dev != 0)
{
set_mixerGain(settings.mixerGainIndex);
}
}
if ((m_settings.mixerFilterIndex != settings.mixerFilterIndex) || force)
{
m_settings.mixerFilterIndex = settings.mixerFilterIndex;
if (m_dev != 0)
{
set_mixerFilter(settings.mixerFilterIndex);
}
}
if ((m_settings.biasCurrentIndex != settings.biasCurrentIndex) || force)
{
m_settings.biasCurrentIndex = settings.biasCurrentIndex;
if (m_dev != 0)
{
set_biasCurrent(settings.biasCurrentIndex);
}
}
if ((m_settings.modeIndex != settings.modeIndex) || force)
{
m_settings.modeIndex = settings.modeIndex;
if (m_dev != 0)
{
set_mode(settings.modeIndex);
}
}
if ((m_settings.gain1Index != settings.gain1Index) || force)
{
m_settings.gain1Index = settings.gain1Index;
if (m_dev != 0)
{
set_gain1(settings.gain1Index);
}
}
if ((m_settings.rcFilterIndex != settings.rcFilterIndex) || force)
{
m_settings.rcFilterIndex = settings.rcFilterIndex;
if (m_dev != 0)
{
set_rcFilter(settings.rcFilterIndex);
}
}
if ((m_settings.gain2Index != settings.gain2Index) || force)
{
m_settings.gain2Index = settings.gain2Index;
if (m_dev != 0)
{
set_gain2(settings.gain2Index);
}
}
if ((m_settings.gain3Index != settings.gain3Index) || force)
{
m_settings.gain3Index = settings.gain3Index;
if (m_dev != 0)
{
set_gain3(settings.gain3Index);
}
}
if ((m_settings.gain4Index != settings.gain4Index) || force)
{
m_settings.gain4Index = settings.gain4Index;
if (m_dev != 0)
{
set_gain4(settings.gain4Index);
}
}
if ((m_settings.ifFilterIndex != settings.ifFilterIndex) || force)
{
m_settings.ifFilterIndex = settings.ifFilterIndex;
if (m_dev != 0)
{
set_ifFilter(settings.ifFilterIndex);
}
}
if ((m_settings.gain5Index != settings.gain5Index) || force)
{
m_settings.gain5Index = settings.gain5Index;
if (m_dev != 0)
{
set_gain5(settings.gain5Index);
}
}
if ((m_settings.gain6Index != settings.gain6Index) || force)
{
m_settings.gain6Index = settings.gain6Index;
if (m_dev != 0)
{
set_gain6(settings.gain6Index);
}
}
if (signalChange)
{
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.centerFrequency);

View File

@ -67,7 +67,7 @@ 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_LOppmTenths);
d.readS32(4, &data.m_lnaGainIndex);
d.readS32(5, &data.m_rfFilterIndex);
d.readS32(6, &data.m_lnaEnhanceIndex);
d.readS32(7, &data.m_bandIndex);