1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

PlutoSDR input: set FIR bandwidth limits and sample rate limits dynamically

This commit is contained in:
f4exb 2017-09-10 19:37:23 +02:00
parent a582e0f628
commit a088f2d30e
6 changed files with 34 additions and 2 deletions

View File

@ -27,6 +27,9 @@ const uint32_t DevicePlutoSDR::bbLPRxHighLimitFreq = 14000000U; // 14 MHz
const uint32_t DevicePlutoSDR::bbLPTxLowLimitFreq = 625000U; // 625 kHz const uint32_t DevicePlutoSDR::bbLPTxLowLimitFreq = 625000U; // 625 kHz
const uint32_t DevicePlutoSDR::bbLPTxHighLimitFreq = 16000000U; // 16 MHz const uint32_t DevicePlutoSDR::bbLPTxHighLimitFreq = 16000000U; // 16 MHz
const float DevicePlutoSDR::firBWLowLimitFactor = 0.1f;
const float DevicePlutoSDR::firBWHighLimitFactor = 0.9f;
DevicePlutoSDR::DevicePlutoSDR() DevicePlutoSDR::DevicePlutoSDR()
{ {
} }

View File

@ -42,7 +42,8 @@ public:
static const uint32_t bbLPRxHighLimitFreq; //!< Analog base band Rx high pass filter lower frequency limit (Hz) static const uint32_t bbLPRxHighLimitFreq; //!< Analog base band Rx high pass filter lower frequency limit (Hz)
static const uint32_t bbLPTxLowLimitFreq; //!< Analog base band Tx low pass filter lower frequency limit (Hz) static const uint32_t bbLPTxLowLimitFreq; //!< Analog base band Tx low pass filter lower frequency limit (Hz)
static const uint32_t bbLPTxHighLimitFreq; //!< Analog base band Tx high pass filter lower frequency limit (Hz) static const uint32_t bbLPTxHighLimitFreq; //!< Analog base band Tx high pass filter lower frequency limit (Hz)
static const float firBWLowLimitFactor; //!< Factor by which the FIR working sample rate is multiplied to yield bandwidth lower limit
static const float firBWHighLimitFactor; //!< Factor by which the FIR working sample rate is multiplied to yield bandwidth higher limit
protected: protected:
DevicePlutoSDR(); DevicePlutoSDR();
~DevicePlutoSDR(); ~DevicePlutoSDR();

View File

@ -23,6 +23,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "dsp/wfir.h" #include "dsp/wfir.h"
#include "deviceplutosdr.h"
#include "deviceplutosdrbox.h" #include "deviceplutosdrbox.h"
DevicePlutoSDRBox::DevicePlutoSDRBox(const std::string& uri) : DevicePlutoSDRBox::DevicePlutoSDRBox(const std::string& uri) :
@ -500,7 +501,9 @@ void DevicePlutoSDRBox::setFIR(uint32_t sampleRate, uint32_t log2IntDec, uint32_
nbTaps = nbGroups*8 > 128 ? 128 : nbGroups*8; nbTaps = nbGroups*8 > 128 ? 128 : nbGroups*8;
nbTaps = intdec == 1 ? (nbTaps > 64 ? 64 : nbTaps) : nbTaps; nbTaps = intdec == 1 ? (nbTaps > 64 ? 64 : nbTaps) : nbTaps;
normalizedBW = ((float) bw) / sampleRates.m_hb1Rate; normalizedBW = ((float) bw) / sampleRates.m_hb1Rate;
normalizedBW = normalizedBW < 0.1 ? 0.1 : normalizedBW > 0.9 ? 0.9 : normalizedBW; normalizedBW = normalizedBW < DevicePlutoSDR::firBWLowLimitFactor ?
DevicePlutoSDR::firBWLowLimitFactor :
normalizedBW > DevicePlutoSDR::firBWHighLimitFactor ? DevicePlutoSDR::firBWHighLimitFactor : normalizedBW;
qDebug("DevicePlutoSDRBox::setFIR: intdec: %u gain: %d nbTaps: %u BWin: %u BW: %f (%f)", qDebug("DevicePlutoSDRBox::setFIR: intdec: %u gain: %d nbTaps: %u BWin: %u BW: %f (%f)",
intdec, intdec,

View File

@ -87,6 +87,7 @@ public:
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
uint32_t getADCSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; } uint32_t getADCSampleRate() const { return m_deviceSampleRates.m_addaConnvRate; }
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
void getRSSI(std::string& rssiStr); void getRSSI(std::string& rssiStr);
bool fetchTemperature(); bool fetchTemperature();
float getTemperature(); float getTemperature();

View File

@ -213,6 +213,8 @@ void PlutoSDRInputGui::on_lpf_changed(quint64 value)
void PlutoSDRInputGui::on_lpFIREnable_toggled(bool checked) void PlutoSDRInputGui::on_lpFIREnable_toggled(bool checked)
{ {
m_settings.m_lpfFIREnable = checked; m_settings.m_lpfFIREnable = checked;
ui->lpFIRDecimation->setEnabled(checked);
ui->lpFIRGain->setEnabled(checked);
sendSettings(); sendSettings();
} }
@ -225,6 +227,7 @@ void PlutoSDRInputGui::on_lpFIR_changed(quint64 value)
void PlutoSDRInputGui::on_lpFIRDecimation_currentIndexChanged(int index) void PlutoSDRInputGui::on_lpFIRDecimation_currentIndexChanged(int index)
{ {
m_settings.m_lpfFIRlog2Decim = index > 2 ? 2 : index; m_settings.m_lpfFIRlog2Decim = index > 2 ? 2 : index;
setSampleRateLimits();
sendSettings(); sendSettings();
} }
@ -271,12 +274,17 @@ void PlutoSDRInputGui::displaySettings()
ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000); ui->lpFIR->setValue(m_settings.m_lpfFIRBW / 1000);
ui->lpFIRDecimation->setCurrentIndex(m_settings.m_lpfFIRlog2Decim); ui->lpFIRDecimation->setCurrentIndex(m_settings.m_lpfFIRlog2Decim);
ui->lpFIRGain->setCurrentIndex((m_settings.m_lpfFIRGain + 6)/6); ui->lpFIRGain->setCurrentIndex((m_settings.m_lpfFIRGain + 6)/6);
ui->lpFIRDecimation->setEnabled(m_settings.m_lpfFIREnable);
ui->lpFIRGain->setEnabled(m_settings.m_lpfFIREnable);
ui->gainMode->setCurrentIndex((int) m_settings.m_gainMode); ui->gainMode->setCurrentIndex((int) m_settings.m_gainMode);
ui->gain->setValue(m_settings.m_gain); ui->gain->setValue(m_settings.m_gain);
ui->gainText->setText(tr("%1").arg(m_settings.m_gain)); ui->gainText->setText(tr("%1").arg(m_settings.m_gain));
ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath); ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath);
setFIRBWLimits();
setSampleRateLimits();
} }
void PlutoSDRInputGui::sendSettings(bool forceSettings) void PlutoSDRInputGui::sendSettings(bool forceSettings)
@ -360,6 +368,19 @@ void PlutoSDRInputGui::updateStatus()
m_statusCounter++; m_statusCounter++;
} }
void PlutoSDRInputGui::setFIRBWLimits()
{
float high = DevicePlutoSDR::firBWHighLimitFactor * ((PlutoSDRInput *) m_sampleSource)->getFIRSampleRate();
float low = DevicePlutoSDR::firBWLowLimitFactor * ((PlutoSDRInput *) m_sampleSource)->getFIRSampleRate();
ui->lpFIR->setValueRange(5, (int(low)/1000)+1, (int(high)/1000)+1);
}
void PlutoSDRInputGui::setSampleRateLimits()
{
uint32_t low = ui->lpFIREnable->isChecked() ? DevicePlutoSDR::srLowLimitFreq / (1<<ui->lpFIRDecimation->currentIndex()) : DevicePlutoSDR::srLowLimitFreq;
ui->sampleRate->setValueRange(8, low, DevicePlutoSDR::srHighLimitFreq);
}
void PlutoSDRInputGui::handleDSPMessages() void PlutoSDRInputGui::handleDSPMessages()
{ {
Message* message; Message* message;
@ -374,6 +395,7 @@ void PlutoSDRInputGui::handleDSPMessages()
m_deviceCenterFrequency = notif->getCenterFrequency(); m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("LimeSDRInputGUI::handleMessagesToGUI: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency()); qDebug("LimeSDRInputGUI::handleMessagesToGUI: SampleRate: %d, CenterFrequency: %llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency(); updateSampleRateAndFrequency();
setFIRBWLimits();
delete message; delete message;
} }

View File

@ -67,6 +67,8 @@ private:
void sendSettings(bool forceSettings = false); void sendSettings(bool forceSettings = false);
void blockApplySettings(bool block); void blockApplySettings(bool block);
void updateSampleRateAndFrequency(); void updateSampleRateAndFrequency();
void setFIRBWLimits();
void setSampleRateLimits();
private slots: private slots:
void on_startStop_toggled(bool checked); void on_startStop_toggled(bool checked);