Skip to content

Commit

Permalink
check return value from sdrplay_api_Update()
Browse files Browse the repository at this point in the history
  • Loading branch information
fventuri committed Oct 25, 2022
1 parent cd79b32 commit aec4ebc
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,19 @@ void SoapySDRPlay::setGain(const int direction, const size_t channel, const std:
else if (name == "RFGR")
{
if (chParams->tunerParams.gain.LNAstate != (int)value) {

chParams->tunerParams.gain.LNAstate = (int)value;
doUpdate = true;
}
}
if ((doUpdate == true) && (streamActive))
{
gr_changed = 0;
sdrplay_api_Update(device.dev, device.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
sdrplay_api_ErrT err = sdrplay_api_Update(device.dev, device.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
if (err != sdrplay_api_Success)
{
SoapySDR_logf(SOAPY_SDR_WARNING, "sdrplay_api_Update(Tuner_Gr) Error: %s", sdrplay_api_GetErrorString(err));
return;
}
for (int i = 0; i < updateTimeout; ++i)
{
if (gr_changed != 0) {
Expand Down Expand Up @@ -610,7 +614,12 @@ void SoapySDRPlay::setFrequency(const int direction,
if (streamActive)
{
rf_changed = 0;
sdrplay_api_Update(device.dev, device.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None);
sdrplay_api_ErrT err = sdrplay_api_Update(device.dev, device.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None);
if (err != sdrplay_api_Success)
{
SoapySDR_logf(SOAPY_SDR_WARNING, "sdrplay_api_Update(Tuner_FrF) Error: %s", sdrplay_api_GetErrorString(err));
return;
}
for (int i = 0; i < updateTimeout; ++i)
{
if (rf_changed != 0) {
Expand Down Expand Up @@ -769,7 +778,12 @@ void SoapySDRPlay::setSampleRate(const int direction, const size_t channel, cons
// 2,685,312 and 2,685,313 the rx_callbacks stop for some
// reason
fs_changed = 0;
sdrplay_api_Update(device.dev, device.tuner, reasonForUpdate, sdrplay_api_Update_Ext1_None);
sdrplay_api_ErrT err = sdrplay_api_Update(device.dev, device.tuner, reasonForUpdate, sdrplay_api_Update_Ext1_None);
if (err != sdrplay_api_Success)
{
SoapySDR_logf(SOAPY_SDR_WARNING, "sdrplay_api_Update(%08x) Error: %s", reasonForUpdate, sdrplay_api_GetErrorString(err));
return;
}
if (waitForUpdate)
{
for (int i = 0; i < updateTimeout; ++i)
Expand Down Expand Up @@ -1384,7 +1398,12 @@ void SoapySDRPlay::writeSetting(const std::string &key, const std::string &value
if (streamActive)
{
gr_changed = 0;
sdrplay_api_Update(device.dev, device.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
sdrplay_api_ErrT err = sdrplay_api_Update(device.dev, device.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
if (err != sdrplay_api_Success)
{
SoapySDR_logf(SOAPY_SDR_WARNING, "sdrplay_api_Update(Tuner_Gr) Error: %s", sdrplay_api_GetErrorString(err));
return;
}
for (int i = 0; i < updateTimeout; ++i)
{
if (gr_changed != 0) {
Expand Down

0 comments on commit aec4ebc

Please sign in to comment.