mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
PlutoSDR input: implemented baseband or device sample rate input option
This commit is contained in:
parent
41fd3ea765
commit
2f3418487d
@ -31,7 +31,7 @@
|
||||
|
||||
const PluginDescriptor HackRFOutputPlugin::m_pluginDescriptor = {
|
||||
QString("HackRF Output"),
|
||||
QString("4.5.3"),
|
||||
QString("4.5.4"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
|
||||
QString("HackRF Input"),
|
||||
QString("4.5.3"),
|
||||
QString("4.5.4"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -36,6 +36,7 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
ui(new Ui::PlutoSDRInputGUI),
|
||||
m_deviceUISet(deviceUISet),
|
||||
m_settings(),
|
||||
m_sampleRateMode(true),
|
||||
m_forceSettings(true),
|
||||
m_sampleSource(NULL),
|
||||
m_sampleRate(0),
|
||||
@ -228,18 +229,33 @@ void PlutoSDRInputGui::on_iqImbalance_toggled(bool checked)
|
||||
void PlutoSDRInputGui::on_swDecim_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_log2Decim = index > 6 ? 6 : index;
|
||||
displaySampleRate();
|
||||
|
||||
if (m_sampleRateMode) {
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
|
||||
} else {
|
||||
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim);
|
||||
}
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::on_fcPos_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_fcPos = (PlutoSDRInputSettings::fcPos_t) (index < (int) PlutoSDRInputSettings::FC_POS_END ? index : PlutoSDRInputSettings::FC_POS_CENTER);
|
||||
displayFcTooltip();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::on_sampleRate_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_devSampleRate = value;
|
||||
if (m_sampleRateMode) {
|
||||
m_settings.m_devSampleRate = value;
|
||||
} else {
|
||||
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Decim);
|
||||
}
|
||||
|
||||
displayFcTooltip();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -306,13 +322,60 @@ void PlutoSDRInputGui::on_transverter_clicked()
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::on_sampleRateMode_toggled(bool checked)
|
||||
{
|
||||
m_sampleRateMode = checked;
|
||||
displaySampleRate();
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::displaySampleRate()
|
||||
{
|
||||
ui->sampleRate->blockSignals(true);
|
||||
displayFcTooltip();
|
||||
|
||||
if (m_sampleRateMode)
|
||||
{
|
||||
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }");
|
||||
ui->sampleRateMode->setText("SR");
|
||||
ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq, DevicePlutoSDR::srHighLimitFreq);
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate);
|
||||
ui->sampleRate->setToolTip("Device to host sample rate (S/s)");
|
||||
ui->deviceRateText->setToolTip("Baseband sample rate (S/s)");
|
||||
uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
|
||||
ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }");
|
||||
ui->sampleRateMode->setText("BB");
|
||||
ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq/(1<<m_settings.m_log2Decim), DevicePlutoSDR::srHighLimitFreq/(1<<m_settings.m_log2Decim));
|
||||
ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim));
|
||||
ui->sampleRate->setToolTip("Baseband sample rate (S/s)");
|
||||
ui->deviceRateText->setToolTip("Device to host sample rate (S/s)");
|
||||
ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5)));
|
||||
}
|
||||
|
||||
ui->sampleRate->blockSignals(false);
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::displayFcTooltip()
|
||||
{
|
||||
int32_t fShift = DeviceSampleSource::calculateFrequencyShift(
|
||||
m_settings.m_log2Decim,
|
||||
(DeviceSampleSource::fcPos_t) m_settings.m_fcPos,
|
||||
m_settings.m_devSampleRate,
|
||||
DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD
|
||||
);
|
||||
ui->fcPos->setToolTip(tr("Relative position of device center frequency: %1 kHz").arg(QString::number(fShift / 1000.0f, 'g', 5)));
|
||||
}
|
||||
|
||||
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);
|
||||
displaySampleRate();
|
||||
|
||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||
@ -397,9 +460,9 @@ void PlutoSDRInputGui::updateStatus()
|
||||
uint32_t adcRate = ((PlutoSDRInput *) m_sampleSource)->getADCSampleRate();
|
||||
|
||||
if (adcRate < 100000000) {
|
||||
ui->adcRateLabel->setText(tr("%1k").arg(QString::number(adcRate / 1000.0f, 'g', 5)));
|
||||
ui->adcRateText->setText(tr("%1k").arg(QString::number(adcRate / 1000.0f, 'g', 5)));
|
||||
} else {
|
||||
ui->adcRateLabel->setText(tr("%1M").arg(QString::number(adcRate / 1000000.0f, 'g', 5)));
|
||||
ui->adcRateText->setText(tr("%1M").arg(QString::number(adcRate / 1000000.0f, 'g', 5)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -491,7 +554,7 @@ void PlutoSDRInputGui::updateSampleRateAndFrequency()
|
||||
{
|
||||
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
||||
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||
ui->deviceRateLabel->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
|
||||
displaySampleRate();
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
Ui::PlutoSDRInputGUI* ui;
|
||||
DeviceUISet* m_deviceUISet;
|
||||
PlutoSDRInputSettings m_settings;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
bool m_forceSettings;
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
@ -69,6 +70,8 @@ private:
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
void displaySettings();
|
||||
void displaySampleRate();
|
||||
void displayFcTooltip();
|
||||
void sendSettings(bool forceSettings = false);
|
||||
void blockApplySettings(bool block);
|
||||
void updateSampleRateAndFrequency();
|
||||
@ -95,6 +98,7 @@ private slots:
|
||||
void on_gain_valueChanged(int value);
|
||||
void on_antenna_currentIndexChanged(int index);
|
||||
void on_transverter_clicked();
|
||||
void on_sampleRateMode_toggled(bool checked);
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
void handleInputMessages();
|
||||
|
@ -91,7 +91,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="freqLeftBotLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="adcRateLabel">
|
||||
<widget class="QLabel" name="adcRateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>54</width>
|
||||
@ -179,7 +179,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="freqRightBotLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceRateLabel">
|
||||
<widget class="QLabel" name="deviceRateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>54</width>
|
||||
@ -503,16 +503,31 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="sampleRateLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="samplerateLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QToolButton" name="sampleRateMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Toggle between device to host (SR) and base band (BB) sample rate input</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SR</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user