mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-26 03:54:30 -04:00
Merge pull request #2814 from rgetz/rgetz-pluto-gain-updates
plutosdr: Update RX gain limits dynamically from hardware
This commit is contained in:
@@ -732,6 +732,19 @@ void PlutoSDRInput::getbbLPRange(quint32& minLimit, quint32& maxLimit)
|
||||
maxLimit = max;
|
||||
}
|
||||
|
||||
void PlutoSDRInput::getGainRange(qint64& minGain, qint64& stepGain, qint64& maxGain)
|
||||
{
|
||||
if (!m_open)
|
||||
{
|
||||
qDebug("PlutoSDRInput::getGainRange: device not open");
|
||||
return;
|
||||
}
|
||||
|
||||
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||
|
||||
plutoBox->getGainRange(minGain, stepGain, maxGain);
|
||||
}
|
||||
|
||||
void PlutoSDRInput::getGain(int& gaindB)
|
||||
{
|
||||
if (!m_open)
|
||||
|
||||
@@ -142,6 +142,7 @@ public:
|
||||
void getRSSI(std::string& rssiStr);
|
||||
void getLORange(qint64& minLimit, qint64& maxLimit);
|
||||
void getbbLPRange(quint32& minLimit, quint32& maxLimit);
|
||||
void getGainRange(qint64& minGain, qint64& stepGain, qint64& maxGain);
|
||||
void getGain(int& gainStr);
|
||||
bool fetchTemperature();
|
||||
float getTemperature();
|
||||
|
||||
@@ -70,6 +70,8 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
((PlutoSDRInput *) m_sampleSource)->getbbLPRange(minLimit, maxLimit);
|
||||
ui->lpf->setValueRange(5, minLimit/1000, maxLimit/1000);
|
||||
|
||||
refreshGainLimits();
|
||||
|
||||
ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
|
||||
ui->lpFIR->setValueRange(5, 1U, 56000U); // will be dynamically recalculated
|
||||
|
||||
@@ -390,6 +392,22 @@ void PlutoSDRInputGui::displaySampleRate()
|
||||
ui->sampleRate->blockSignals(false);
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::refreshGainLimits()
|
||||
{
|
||||
qint64 minGain, stepGain, maxGain;
|
||||
((PlutoSDRInput *) m_sampleSource)->getGainRange(minGain, stepGain, maxGain);
|
||||
|
||||
// Only update the gui when necessary, avoid unnecessary widget updates
|
||||
if (ui->gain->minimum() != minGain ||
|
||||
ui->gain->maximum() != maxGain ||
|
||||
ui->gain->singleStep() != stepGain)
|
||||
{
|
||||
ui->gain->setMinimum(minGain);
|
||||
ui->gain->setMaximum(maxGain);
|
||||
ui->gain->setSingleStep(stepGain);
|
||||
}
|
||||
}
|
||||
|
||||
void PlutoSDRInputGui::displayFcTooltip()
|
||||
{
|
||||
int32_t fShift = DeviceSampleSource::calculateFrequencyShift(
|
||||
@@ -600,6 +618,7 @@ void PlutoSDRInputGui::updateSampleRateAndFrequency()
|
||||
{
|
||||
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
||||
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||
refreshGainLimits();
|
||||
displaySampleRate();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ private:
|
||||
void sendSettings(bool forceSettings = false);
|
||||
void blockApplySettings(bool block);
|
||||
void updateSampleRateAndFrequency();
|
||||
void refreshGainLimits();
|
||||
void setFIRBWLimits();
|
||||
void setSampleRateLimits();
|
||||
void updateFrequencyLimits();
|
||||
|
||||
@@ -71,7 +71,7 @@ QByteArray PlutoSDRInputSettings::serialize() const
|
||||
s.writeBool(10, m_lpfFIREnable);
|
||||
s.writeU32(11, m_lpfFIRBW);
|
||||
s.writeU64(12, m_devSampleRate);
|
||||
s.writeU32(13, m_gain);
|
||||
s.writeS32(13, m_gain);
|
||||
s.writeS32(14, (int) m_antennaPath);
|
||||
s.writeS32(15, (int) m_gainMode);
|
||||
s.writeBool(16, m_transverterMode);
|
||||
@@ -125,7 +125,7 @@ bool PlutoSDRInputSettings::deserialize(const QByteArray& data)
|
||||
d.readBool(10, &m_lpfFIREnable, false);
|
||||
d.readU32(11, &m_lpfFIRBW, 500000U);
|
||||
d.readU64(12, &m_devSampleRate, 1536000U);
|
||||
d.readU32(13, &m_gain, 40);
|
||||
d.readS32(13, &m_gain, 40);
|
||||
d.readS32(14, &intval, 0);
|
||||
if ((intval >= 0) && (intval < (int) RFPATH_END)) {
|
||||
m_antennaPath = (RFPath) intval;
|
||||
|
||||
@@ -77,7 +77,7 @@ struct PlutoSDRInputSettings {
|
||||
bool m_hwIQCorrection; //!< Hardware IQ correction
|
||||
quint32 m_log2Decim;
|
||||
quint32 m_lpfBW; //!< analog lowpass filter bandwidth (Hz)
|
||||
quint32 m_gain; //!< "hardware" gain
|
||||
qint32 m_gain; //!< "hardware" gain
|
||||
RFPath m_antennaPath;
|
||||
GainMode m_gainMode;
|
||||
bool m_transverterMode;
|
||||
|
||||
Reference in New Issue
Block a user