mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-06 07:07:48 -04:00
PlutoSDR input: implemented transverter feature
This commit is contained in:
parent
3a6d6f63b1
commit
24413bfb7d
@ -367,15 +367,6 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
|||||||
forwardChangeOwnDSP = 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||||
{
|
{
|
||||||
plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
|
plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
|
||||||
@ -385,11 +376,59 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
|
|||||||
std::vector<std::string> params;
|
std::vector<std::string> params;
|
||||||
bool paramsToSet = false;
|
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());
|
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||||
paramsToSet = true;
|
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||||
forwardChangeOwnDSP = true;
|
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)
|
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
|
||||||
|
@ -44,7 +44,7 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent)
|
|||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
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->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
|
||||||
ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq, DevicePlutoSDR::srHighLimitFreq);
|
ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq, DevicePlutoSDR::srHighLimitFreq);
|
||||||
@ -275,8 +275,21 @@ void PlutoSDRInputGui::on_antenna_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
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()
|
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->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||||
|
|
||||||
@ -402,20 +415,35 @@ void PlutoSDRInputGui::setSampleRateLimits()
|
|||||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
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()
|
void PlutoSDRInputGui::handleInputMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||||
{
|
{
|
||||||
qDebug("LimeSDRInputGUI::handleInputMessages: message: %s", message->getIdentifier());
|
qDebug("PlutoSDRInputGui::handleInputMessages: message: %s", message->getIdentifier());
|
||||||
|
|
||||||
if (DSPSignalNotification::match(*message))
|
if (DSPSignalNotification::match(*message))
|
||||||
{
|
{
|
||||||
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||||
m_sampleRate = notif->getSampleRate();
|
m_sampleRate = notif->getSampleRate();
|
||||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
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();
|
updateSampleRateAndFrequency();
|
||||||
setFIRBWLimits();
|
setFIRBWLimits();
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
void updateSampleRateAndFrequency();
|
void updateSampleRateAndFrequency();
|
||||||
void setFIRBWLimits();
|
void setFIRBWLimits();
|
||||||
void setSampleRateLimits();
|
void setSampleRateLimits();
|
||||||
|
void updateFrequencyLimits();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
@ -91,6 +92,7 @@ private slots:
|
|||||||
void on_gainMode_currentIndexChanged(int index);
|
void on_gainMode_currentIndexChanged(int index);
|
||||||
void on_gain_valueChanged(int value);
|
void on_gain_valueChanged(int value);
|
||||||
void on_antenna_currentIndexChanged(int index);
|
void on_antenna_currentIndexChanged(int index);
|
||||||
|
void on_transverter_clicked();
|
||||||
void updateHardware();
|
void updateHardware();
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
|
@ -275,6 +275,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -937,6 +953,11 @@
|
|||||||
<extends>QToolButton</extends>
|
<extends>QToolButton</extends>
|
||||||
<header>gui/buttonswitch.h</header>
|
<header>gui/buttonswitch.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>TransverterButton</class>
|
||||||
|
<extends>QPushButton</extends>
|
||||||
|
<header>gui/transverterbutton.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
|
@ -28,7 +28,7 @@ class DeviceSourceAPI;
|
|||||||
|
|
||||||
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
|
||||||
QString("PlutoSDR Input"),
|
QString("PlutoSDR Input"),
|
||||||
QString("3.7.2"),
|
QString("3.7.3"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -41,6 +41,8 @@ void PlutoSDRInputSettings::resetToDefaults()
|
|||||||
m_gain = 40;
|
m_gain = 40;
|
||||||
m_antennaPath = RFPATH_A_BAL;
|
m_antennaPath = RFPATH_A_BAL;
|
||||||
m_gainMode = GAIN_MANUAL;
|
m_gainMode = GAIN_MANUAL;
|
||||||
|
m_transverterMode = false;
|
||||||
|
m_transverterDeltaFrequency = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray PlutoSDRInputSettings::serialize() const
|
QByteArray PlutoSDRInputSettings::serialize() const
|
||||||
@ -61,6 +63,8 @@ QByteArray PlutoSDRInputSettings::serialize() const
|
|||||||
s.writeU32(13, m_gain);
|
s.writeU32(13, m_gain);
|
||||||
s.writeS32(14, (int) m_antennaPath);
|
s.writeS32(14, (int) m_antennaPath);
|
||||||
s.writeS32(15, (int) m_gainMode);
|
s.writeS32(15, (int) m_gainMode);
|
||||||
|
s.writeBool(16, m_transverterMode);
|
||||||
|
s.writeS64(17, m_transverterDeltaFrequency);
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
@ -114,6 +118,8 @@ bool PlutoSDRInputSettings::deserialize(const QByteArray& data)
|
|||||||
} else {
|
} else {
|
||||||
m_gainMode = GAIN_MANUAL;
|
m_gainMode = GAIN_MANUAL;
|
||||||
}
|
}
|
||||||
|
d.readBool(16, &m_transverterMode, false);
|
||||||
|
d.readS64(17, &m_transverterDeltaFrequency, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,8 @@ struct PlutoSDRInputSettings {
|
|||||||
quint32 m_gain; //!< "hardware" gain
|
quint32 m_gain; //!< "hardware" gain
|
||||||
RFPath m_antennaPath;
|
RFPath m_antennaPath;
|
||||||
GainMode m_gainMode;
|
GainMode m_gainMode;
|
||||||
|
bool m_transverterMode;
|
||||||
|
qint64 m_transverterDeltaFrequency;
|
||||||
|
|
||||||
|
|
||||||
PlutoSDRInputSettings();
|
PlutoSDRInputSettings();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user