1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

FunCube Pro input: implemented transverter feature

This commit is contained in:
f4exb 2017-09-25 20:16:25 +02:00
parent 37d44038f4
commit d9d1b8bfec
10 changed files with 97 additions and 17 deletions

View File

@ -1,5 +1,6 @@
# Udev rules for the Funcube Dongle Pro+ (0xfb31)
# HIDAPI/libusb:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fb31", GROUP:="audio", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fb56", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fb31", MODE:="0666"

View File

@ -22,5 +22,11 @@ const char *fcd_traits<ProPlus>::displayedName = "FunCube Dongle Pro+";
const char *fcd_traits<Pro>::pluginDisplayedName = "FunCube Pro Input";
const char *fcd_traits<ProPlus>::pluginDisplayedName = "FunCube Pro+ Input";
const char *fcd_traits<Pro>::pluginVersion = "3.5.0";
const char *fcd_traits<Pro>::pluginVersion = "3.7.3";
const char *fcd_traits<ProPlus>::pluginVersion = "3.5.0";
const int64_t fcd_traits<Pro>::loLowLimitFreq = 64000000L;
const int64_t fcd_traits<ProPlus>::loLowLimitFreq = 64000000L;
const int64_t fcd_traits<Pro>::loHighLimitFreq = 1700000000L;
const int64_t fcd_traits<ProPlus>::loHighLimitFreq = 1700000000L;

View File

@ -30,6 +30,8 @@ struct fcd_traits
static const char *displayedName;
static const char *pluginDisplayedName;
static const char *pluginVersion;
static const int64_t loLowLimitFreq;
static const int64_t loHighLimitFreq;
};
template<>
@ -46,6 +48,8 @@ struct fcd_traits<Pro>
static const char *displayedName;
static const char *pluginDisplayedName;
static const char *pluginVersion;
static const int64_t loLowLimitFreq;
static const int64_t loHighLimitFreq;
};
template<>
@ -62,6 +66,8 @@ struct fcd_traits<ProPlus>
static const char *displayedName;
static const char *pluginDisplayedName;
static const char *pluginVersion;
static const int64_t loLowLimitFreq;
static const int64_t loHighLimitFreq;
};
template <fcd_type FCDType> const char *fcd_traits<FCDType>::alsaDeviceName = "";

View File

@ -28,7 +28,7 @@ class DeviceSourceAPI;
const PluginDescriptor PlutoSDROutputPlugin::m_pluginDescriptor = {
QString("PlutoSDR Output"),
QString("3.7.2"),
QString("3.7.3"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -25,6 +25,7 @@
#include <device/devicesourceapi.h>
#include "fcdproconst.h"
#include "fcdtraits.h"
FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
QWidget(parent),
@ -38,7 +39,7 @@ FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, 64000U, 1700000U);
updateFrequencyLimits();
ui->lnaGain->clear();
for (int i = 0; i < FCDProConstants::fcdpro_lna_gain_nb_values(); i++)
@ -237,8 +238,26 @@ void FCDProGui::updateSampleRateAndFrequency()
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
}
void FCDProGui::updateFrequencyLimits()
{
// values in kHz
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
qint64 minLimit = fcd_traits<Pro>::loLowLimitFreq/1000 + deltaFrequency;
qint64 maxLimit = fcd_traits<Pro>::loHighLimitFreq/1000 + deltaFrequency;
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
qDebug("FCDProGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
}
void FCDProGui::displaySettings()
{
ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode);
updateFrequencyLimits();
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->ppm->setValue(m_settings.m_LOppmTenths);
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
@ -440,6 +459,16 @@ void FCDProGui::on_record_toggled(bool checked)
m_sampleSource->getInputMessageQueue()->push(message);
}
void FCDProGui::on_transverter_clicked()
{
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
qDebug("FCDProGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
updateFrequencyLimits();
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
sendSettings();
}
void FCDProGui::updateStatus()
{
int state = m_deviceAPI->state();

View File

@ -68,6 +68,7 @@ private:
void displaySettings();
void sendSettings();
void updateSampleRateAndFrequency();
void updateFrequencyLimits();
private slots:
void handleInputMessages();
@ -95,6 +96,7 @@ private slots:
void on_setDefaults_clicked(bool checked);
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_transverter_clicked();
void updateHardware();
void updateStatus();
};

View File

@ -6,20 +6,20 @@
<rect>
<x>0</x>
<y>0</y>
<width>270</width>
<height>335</height>
<width>320</width>
<height>350</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>270</width>
<height>335</height>
<width>320</width>
<height>350</height>
</size>
</property>
<property name="font">
@ -238,6 +238,22 @@
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
<item>
@ -484,6 +500,11 @@
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>TransverterButton</class>
<extends>QPushButton</extends>
<header>gui/transverterbutton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>

View File

@ -201,16 +201,23 @@ void FCDProInput::applySettings(const FCDProSettings& settings, bool force)
{
bool signalChange = false;
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
{
qDebug() << "FCDProInput::applySettings: fc: " << settings.m_centerFrequency;
qint64 deviceCenterFrequency = settings.m_centerFrequency;
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
if (m_dev != 0)
{
set_center_freq((double) deviceCenterFrequency);
}
qDebug() << "FCDProInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz";
m_settings.m_centerFrequency = settings.m_centerFrequency;
if (m_dev != 0)
{
set_center_freq((double) m_settings.m_centerFrequency);
}
signalChange = true;
}

View File

@ -45,6 +45,8 @@ void FCDProSettings::resetToDefaults()
m_ifFilterIndex = 0;
m_gain5Index = 0;
m_gain6Index = 0;
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
}
QByteArray FCDProSettings::serialize() const
@ -70,6 +72,8 @@ QByteArray FCDProSettings::serialize() const
s.writeS32(17, m_ifFilterIndex);
s.writeS32(18, m_gain5Index);
s.writeS32(19, m_gain6Index);
s.writeBool(20, m_transverterMode);
s.writeS64(21, m_transverterDeltaFrequency);
return s.final();
}
@ -105,6 +109,8 @@ bool FCDProSettings::deserialize(const QByteArray& data)
d.readS32(17, &m_ifFilterIndex, 0);
d.readS32(18, &m_gain5Index, 0);
d.readS32(19, &m_gain6Index, 0);
d.readBool(20, &m_transverterMode, false);
d.readS64(21, &m_transverterDeltaFrequency, 0);
return true;
}

View File

@ -38,6 +38,8 @@ struct FCDProSettings {
qint32 m_gain6Index;
bool m_dcBlock;
bool m_iqCorrection;
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
FCDProSettings();
void resetToDefaults();