1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-26 12:04:13 -04:00

plutosdr: Update RX gain limits dynamically from hardware

Query the PlutoSDR hardware for the current RX gain range and use it
to configure the GUI gain control dynamically.

The AD936x gain limits vary with LO frequency. Previously the GUI used
a fixed gain range, allowing users to select values that the hardware
would reject after changing bands. The gain slider now refreshes its
minimum, maximum, and step size whenever the device center frequency is
updated.

Also change the gain setting serialization to use a signed integer so
negative gain values are preserved for operating modes that support
them.

Changes include:
- Add DevicePlutoSDRBox::getGainRange() to read
  in_voltage0_hardwaregain_available.
- Expose gain range through PlutoSDRInput.
- Refresh GUI gain limits when the device frequency changes.
- Avoid unnecessary widget updates when limits are unchanged.
- Store/restore gain as a signed value.
- Add default RX gain limit constants for fallback when the device
  cannot provide its range.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
This commit is contained in:
Robin Getz
2026-07-19 17:48:53 -04:00
parent 50fee6f643
commit 72d612d986
10 changed files with 64 additions and 3 deletions
@@ -721,6 +721,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)