1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 21:01:45 -05:00

PlutoSDR input: implemented transverter feature

This commit is contained in:
f4exb 2017-09-24 13:03:08 +02:00
parent 3a6d6f63b1
commit 24413bfb7d
7 changed files with 115 additions and 17 deletions

View File

@ -367,15 +367,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
forwardChangeOwnDSP = true;
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
if (m_plutoSDRInputThread != 0)
{
m_plutoSDRInputThread->setFcPos(settings.m_fcPos);
qDebug() << "PlutoSDRInput::applySettings: set fcPos to " << settings.m_fcPos;
}
}
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
{
plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
@ -385,11 +376,59 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
std::vector<std::string> params;
bool paramsToSet = false;
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force)
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_fcPos != settings.m_fcPos)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
{
params.push_back(QString(tr("out_altvoltage0_RX_LO_frequency=%1").arg(settings.m_centerFrequency)).toStdString());
paramsToSet = true;
forwardChangeOwnDSP = true;
qint64 deviceCenterFrequency = settings.m_centerFrequency;
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
qint64 f_img = deviceCenterFrequency;
quint32 devSampleRate = settings.m_devSampleRate;
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == PlutoSDRInputSettings::FC_POS_CENTER))
{
f_img = deviceCenterFrequency;
}
else
{
if (settings.m_fcPos == PlutoSDRInputSettings::FC_POS_INFRA)
{
deviceCenterFrequency += (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2;
}
else if (settings.m_fcPos == PlutoSDRInputSettings::FC_POS_SUPRA)
{
deviceCenterFrequency -= (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2;
}
}
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
{
params.push_back(QString(tr("out_altvoltage0_RX_LO_frequency=%1").arg(deviceCenterFrequency)).toStdString());
paramsToSet = true;
forwardChangeOwnDSP = true;
}
if ((m_settings.m_fcPos != settings.m_fcPos) || force)
{
if (m_plutoSDRInputThread != 0)
{
m_plutoSDRInputThread->setFcPos(settings.m_fcPos);
qDebug() << "PlutoSDRInput::applySettings: set fcPos to " << settings.m_fcPos;
}
}
qDebug() << "PlutoSDRInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz"
<< " device center freq: " << deviceCenterFrequency << " Hz"
<< " device sample rate: " << devSampleRate << "S/s"
<< " Actual sample rate: " << devSampleRate/(1<<settings.m_log2Decim) << "S/s"
<< " img: " << f_img << "Hz";
}
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)

View File

@ -44,7 +44,7 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent)
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, DevicePlutoSDR::loLowLimitFreq/1000, DevicePlutoSDR::loHighLimitFreq/1000);
updateFrequencyLimits();
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq, DevicePlutoSDR::srHighLimitFreq);
@ -275,8 +275,21 @@ void PlutoSDRInputGui::on_antenna_currentIndexChanged(int index)
sendSettings();
}
void PlutoSDRInputGui::on_transverter_clicked()
{
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
qDebug("PlutoSDRInputGui::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 PlutoSDRInputGui::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->sampleRate->setValue(m_settings.m_devSampleRate);
@ -402,20 +415,35 @@ void PlutoSDRInputGui::setSampleRateLimits()
ui->sampleRate->setValue(m_settings.m_devSampleRate);
}
void PlutoSDRInputGui::updateFrequencyLimits()
{
// values in kHz
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
qint64 minLimit = DevicePlutoSDR::loLowLimitFreq/1000 + deltaFrequency;
qint64 maxLimit = DevicePlutoSDR::loHighLimitFreq/1000 + deltaFrequency;
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
qDebug("PlutoSDRInputGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
}
void PlutoSDRInputGui::handleInputMessages()
{
Message* message;
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("LimeSDRInputGUI::handleInputMessages: message: %s", message->getIdentifier());
qDebug("PlutoSDRInputGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("LimeSDRInputGUI::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("PlutoSDRInputGui::handleInputMessages: DSPSignalNotification: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
setFIRBWLimits();

View File

@ -72,6 +72,7 @@ private:
void updateSampleRateAndFrequency();
void setFIRBWLimits();
void setSampleRateLimits();
void updateFrequencyLimits();
private slots:
void on_startStop_toggled(bool checked);
@ -91,6 +92,7 @@ private slots:
void on_gainMode_currentIndexChanged(int index);
void on_gain_valueChanged(int value);
void on_antenna_currentIndexChanged(int index);
void on_transverter_clicked();
void updateHardware();
void updateStatus();
void handleInputMessages();

View File

@ -275,6 +275,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>
@ -937,6 +953,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

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

View File

@ -41,6 +41,8 @@ void PlutoSDRInputSettings::resetToDefaults()
m_gain = 40;
m_antennaPath = RFPATH_A_BAL;
m_gainMode = GAIN_MANUAL;
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
}
QByteArray PlutoSDRInputSettings::serialize() const
@ -61,6 +63,8 @@ QByteArray PlutoSDRInputSettings::serialize() const
s.writeU32(13, m_gain);
s.writeS32(14, (int) m_antennaPath);
s.writeS32(15, (int) m_gainMode);
s.writeBool(16, m_transverterMode);
s.writeS64(17, m_transverterDeltaFrequency);
return s.final();
}
@ -114,6 +118,8 @@ bool PlutoSDRInputSettings::deserialize(const QByteArray& data)
} else {
m_gainMode = GAIN_MANUAL;
}
d.readBool(16, &m_transverterMode, false);
d.readS64(17, &m_transverterDeltaFrequency, 0);
return true;
}

View File

@ -71,6 +71,8 @@ struct PlutoSDRInputSettings {
quint32 m_gain; //!< "hardware" gain
RFPath m_antennaPath;
GainMode m_gainMode;
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
PlutoSDRInputSettings();