1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-08 08:54:49 -04:00

Add support for lnaGain API setting, to allow gain to be set more easily.

This commit is contained in:
Jon Beniston
2023-09-15 09:32:41 +01:00
parent a278cf0373
commit 1b1530f10d
7 changed files with 87 additions and 12 deletions
+4 -7
View File
@@ -502,10 +502,9 @@ bool ChannelWebAPIUtils::getGain(unsigned int deviceIndex, int stage, int &gain)
}
else if ((devId == "SDRplayV3"))
{
QStringList sdrplayStages = {"lnaIndex", "ifGain"};
QStringList sdrplayStages = {"lnaGain", "ifGain"};
if (stage < sdrplayStages.size())
{
// FIXME: How to map to lnaIndex - gain can vary by SDR
error = ChannelWebAPIUtils::getDeviceSetting(deviceIndex, sdrplayStages[stage], gain);
gain *= 10;
}
@@ -561,10 +560,8 @@ bool ChannelWebAPIUtils::setGain(unsigned int deviceIndex, int stage, int gain)
}
else if (devId == "SDRplayV3")
{
QStringList sdrplayStages = {"lnaIndex", "ifGain"};
if (stage < sdrplayStages.size())
{
// FIXME: How to map to lnaIndex - gain can vary by SDR
QStringList sdrplayStages = {"lnaGain", "ifGain"};
if (stage < sdrplayStages.size()) {
return ChannelWebAPIUtils::patchDeviceSetting(deviceIndex, sdrplayStages[stage], gain / 10);
}
}
@@ -1120,7 +1117,7 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr
if (getDeviceSettings(deviceIndex, deviceSettingsResponse, deviceSet))
{
// Patch centerFrequency
// Patch setting
QJsonObject *jsonObj = deviceSettingsResponse.asJsonObject();
int oldValue;
if (WebAPIUtils::getSubObjectInt(*jsonObj, setting, oldValue))