Skip to content

Comments

Fix getgain incorrect calculation#17

Open
bkerler wants to merge 1 commit intomyriadrf:masterfrom
bkerler:soapyfix2
Open

Fix getgain incorrect calculation#17
bkerler wants to merge 1 commit intomyriadrf:masterfrom
bkerler:soapyfix2

Conversation

@bkerler
Copy link

@bkerler bkerler commented Jul 30, 2019

Fix for issue xtrx-sdr/images#60.

The Rx Gain is being calculated by adding all gains. Having a look at the implementation: https://github.com/pothosware/SoapySDR/blob/fe8dfd1879a8512aa305045ef1e6657a5a33f3b9/lib/Device.cpp#L313-L314

The issue seems to be this line :
https://github.com/xtrx-sdr/libxtrx/blob/4f1eb7b5f77c90bc8d0db2a17fe338372e3d4277/soapy/SoapyXTRX.cpp#L365

On setting the lna gain to 20 and all other gains to 0, the SoapySDR getgain function will return 30 instead.

The root cause is that the minimum gain from the getrange function is being substracted (here -12). As 18-(-12)=30, the negative value seems to cause the issue. Thus setting the minimum at https://github.com/xtrx-sdr/libxtrx/blob/4f1eb7b5f77c90bc8d0db2a17fe338372e3d4277/soapy/SoapyXTRX.cpp#L365 to 0 instead of -12 does fix that issue.

@bkerler
Copy link
Author

bkerler commented Jul 30, 2019

This also fixes issue #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant