mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-03 13:47:50 -04:00
PlutoSDR input: display actual gain value returned from device
This commit is contained in:
parent
ccee9dbf28
commit
e87ee16302
@ -626,6 +626,37 @@ void DevicePlutoSDRBox::getXO()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DevicePlutoSDRBox::getRxGain(int& gaindB, unsigned int chan)
|
||||||
|
{
|
||||||
|
chan = chan % 2;
|
||||||
|
char buff[30];
|
||||||
|
snprintf(buff, sizeof(buff), "in_voltage%d_hardwaregain", chan);
|
||||||
|
std::string gainStr;
|
||||||
|
get_param(DEVICE_PHY, buff, gainStr);
|
||||||
|
|
||||||
|
std::regex gain_regex("(.+)\\.(.+) dB");
|
||||||
|
std::smatch gain_match;
|
||||||
|
std::regex_search(gainStr, gain_match, gain_regex);
|
||||||
|
|
||||||
|
if (gain_match.size() == 3)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
gaindB = boost::lexical_cast<int>(gain_match[1]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const boost::bad_lexical_cast &e)
|
||||||
|
{
|
||||||
|
qWarning("DevicePlutoSDRBox::getRxGain: bad conversion to numeric");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DevicePlutoSDRBox::getRxRSSI(std::string& rssiStr, unsigned int chan)
|
bool DevicePlutoSDRBox::getRxRSSI(std::string& rssiStr, unsigned int chan)
|
||||||
{
|
{
|
||||||
chan = chan % 2;
|
chan = chan % 2;
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
void setFIR(uint32_t sampleRate, uint32_t intdec, DeviceUse use, uint32_t bw, int gain);
|
void setFIR(uint32_t sampleRate, uint32_t intdec, DeviceUse use, uint32_t bw, int gain);
|
||||||
void setFIREnable(bool enable);
|
void setFIREnable(bool enable);
|
||||||
void setLOPPMTenths(int ppmTenths);
|
void setLOPPMTenths(int ppmTenths);
|
||||||
|
bool getRxGain(int& gaindB, unsigned int chan);
|
||||||
bool getRxRSSI(std::string& rssiStr, unsigned int chan);
|
bool getRxRSSI(std::string& rssiStr, unsigned int chan);
|
||||||
bool getTxRSSI(std::string& rssiStr, unsigned int chan);
|
bool getTxRSSI(std::string& rssiStr, unsigned int chan);
|
||||||
bool fetchTemp();
|
bool fetchTemp();
|
||||||
|
@ -538,6 +538,15 @@ void PlutoSDRInput::getRSSI(std::string& rssiStr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlutoSDRInput::getGain(int& gaindB)
|
||||||
|
{
|
||||||
|
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||||
|
|
||||||
|
if (!plutoBox->getRxGain(gaindB, 0)) {
|
||||||
|
gaindB = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool PlutoSDRInput::fetchTemperature()
|
bool PlutoSDRInput::fetchTemperature()
|
||||||
{
|
{
|
||||||
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||||
|
@ -90,6 +90,7 @@ public:
|
|||||||
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; }
|
uint32_t getFIRSampleRate() const { return m_deviceSampleRates.m_hb1Rate; }
|
||||||
void getRSSI(std::string& rssiStr);
|
void getRSSI(std::string& rssiStr);
|
||||||
|
void getGain(int& gainStr);
|
||||||
bool fetchTemperature();
|
bool fetchTemperature();
|
||||||
float getTemperature();
|
float getTemperature();
|
||||||
|
|
||||||
|
@ -386,6 +386,9 @@ void PlutoSDRInputGui::updateStatus()
|
|||||||
std::string rssiStr;
|
std::string rssiStr;
|
||||||
((PlutoSDRInput *) m_sampleSource)->getRSSI(rssiStr);
|
((PlutoSDRInput *) m_sampleSource)->getRSSI(rssiStr);
|
||||||
ui->rssiText->setText(tr("-%1").arg(QString::fromStdString(rssiStr)));
|
ui->rssiText->setText(tr("-%1").arg(QString::fromStdString(rssiStr)));
|
||||||
|
int gaindB;
|
||||||
|
((PlutoSDRInput *) m_sampleSource)->getGain(gaindB);
|
||||||
|
ui->actualGainText->setText(tr("%1").arg(gaindB));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_statusCounter % 10 == 0) // 5s
|
if (m_statusCounter % 10 == 0) // 5s
|
||||||
|
@ -848,6 +848,25 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="actualGainText">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Actual gain (dB)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>00</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_3">
|
<widget class="Line" name="line_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -28,7 +28,7 @@ class DeviceSourceAPI;
|
|||||||
|
|
||||||
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
|
||||||
QString("PlutoSDR Input"),
|
QString("PlutoSDR Input"),
|
||||||
QString("3.7.3"),
|
QString("3.7.4"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user