diff --git a/plugins/samplesource/fcdpro/fcdprogui.cpp b/plugins/samplesource/fcdpro/fcdprogui.cpp index 6cc139d02..0cc403b4a 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.cpp +++ b/plugins/samplesource/fcdpro/fcdprogui.cpp @@ -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); diff --git a/plugins/samplesource/fcdpro/fcdprogui.h b/plugins/samplesource/fcdpro/fcdprogui.h index 668de80f5..44daf12a3 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.h +++ b/plugins/samplesource/fcdpro/fcdprogui.h @@ -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(); }; diff --git a/plugins/samplesource/fcdpro/fcdprogui.ui b/plugins/samplesource/fcdpro/fcdprogui.ui index b26e13b17..334a0ca55 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.ui +++ b/plugins/samplesource/fcdpro/fcdprogui.ui @@ -115,10 +115,10 @@ LO ppm correction - -1000 + -2000 - 1000 + 2000 1 @@ -140,14 +140,7 @@ - - - Bias T - - - - - + Defaults @@ -155,30 +148,6 @@ - - - - - - LNA G - - - - - - - - - - RF filt - - - - - - - - @@ -203,30 +172,6 @@ - - - - - - Mix G - - - - - - - - - - Mix filt - - - - - - - - @@ -251,6 +196,54 @@ + + + + + + LNA G + + + + + + + + + + RF filt + + + + + + + + + + + + + + Mix G + + + + + + + + + + Mix filt + + + + + + + + diff --git a/plugins/samplesource/fcdpro/fcdproinput.cpp b/plugins/samplesource/fcdpro/fcdproinput.cpp index 49a97f015..ee9624d96 100644 --- a/plugins/samplesource/fcdpro/fcdproinput.cpp +++ b/plugins/samplesource/fcdpro/fcdproinput.cpp @@ -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::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); +} diff --git a/plugins/samplesource/fcdpro/fcdproinput.h b/plugins/samplesource/fcdpro/fcdproinput.h index fe00b46b1..5a2401f44 100644 --- a/plugins/samplesource/fcdpro/fcdproinput.h +++ b/plugins/samplesource/fcdpro/fcdproinput.h @@ -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; diff --git a/plugins/samplesource/fcdpro/fcdproserializer.cpp b/plugins/samplesource/fcdpro/fcdproserializer.cpp index 2889c5f6d..81acf2b00 100644 --- a/plugins/samplesource/fcdpro/fcdproserializer.cpp +++ b/plugins/samplesource/fcdpro/fcdproserializer.cpp @@ -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; diff --git a/plugins/samplesource/fcdpro/fcdproserializer.h b/plugins/samplesource/fcdpro/fcdproserializer.h index 244c66a79..cf1beeb2a 100644 --- a/plugins/samplesource/fcdpro/fcdproserializer.h +++ b/plugins/samplesource/fcdpro/fcdproserializer.h @@ -26,7 +26,6 @@ public: { SampleSourceSerializer::Data m_data; qint32 m_LOppmTenths; - bool m_biasT; qint32 m_lnaGainIndex; qint32 m_rfFilterIndex; qint32 m_lnaEnhanceIndex;