Skip to content

Safer calls to setGainMode - #701

Merged
cjcliffe merged 1 commit into
cjcliffe:masterfrom
drahosj:master
Mar 15, 2019
Merged

cjcliffe merged 1 commit into
cjcliffe:masterfrom
drahosj:master

Conversation

@drahosj

@drahosj drahosj commented Jan 14, 2019

Copy link
Copy Markdown
Contributor

Will call hasGainMode first - this will prevent crashes when the underlying
device situationally doesn't support setGainMode calls.

This issue rears its head with the BladeRF - because AGC is only provided when a LUT is generated, it's really quite variable whether or not setGainMode will work, or will error out. As such, it would be best to avoid calling it without a call to hasGainMode to make sure it's supported.

Note that this requires a trustworthy result from hasGainMode; which is currently not the case for SoapyBladeRF. Things still crash because hasGainMode always returns true (for the RX channel), even when it actually doesn't. But that's a separate issue.

Will call hasGainMode first - this will prevent crashes when the underlying
device situationally doesn't support setGainMode calls.
@guruofquality

Copy link
Copy Markdown

Note that this requires a trustworthy result from hasGainMode; which is currently not the case for SoapyBladeRF. Things still crash because hasGainMode always returns true (for the RX channel), even when it actually doesn't. But that's a separate issue.

There was a lot of chaos from the v2 api release and bladrf2 support. Hopefully most of that is cleaned up now :-) Anyway, lets fix this. Open an issue with the details, or make a PR: https://github.com/pothosware/SoapyBladeRF

@drahosj

drahosj commented Jan 14, 2019

Copy link
Copy Markdown
Contributor Author

I am fixing a few things with SoapyBladeRF and I think it is working now. I'm waiting for DC cal to run so that I can test it with the AGC - but it does work falling back to manual gain.

The changes amounted to 1. Implementing a fairly robust hasGainMode that actually tries to enable automatic mode and 2. Re-adding support for the list functions (bandwidth and sample rate) - even though they were supplanted by the range-oriented functions, it really makes sense for the Soapy plugin itself to provide "recommended" values in the way that Soapy does.

@drahosj

drahosj commented Jan 14, 2019

Copy link
Copy Markdown
Contributor Author

So I have tested this out - with a DC cal table present, it starts up with AGC and everything runs great. Without a DC cal table, it at least doesn't crash.

Things are a little less than ideal, though, as it's not reflected to the user that it's in manual gain mode. The backend calls to setGainMode are skipped, but it would be best for the UI to somehow know that AGC isn't available, and run locked into manual gain mode.

@cjcliffe cjcliffe self-assigned this Jan 16, 2019
@cjcliffe
cjcliffe merged commit 4ca6e8d into cjcliffe:master Mar 15, 2019
@cjcliffe

Copy link
Copy Markdown
Owner

@drahosj thanks for the contribution; it will surely help avoid some unwanted crashes. And I agree we should probably handle this at the UI level at some point as suggested.

@drahosj

drahosj commented Mar 15, 2019 via email

Copy link
Copy Markdown
Contributor Author

@drahosj

drahosj commented Mar 15, 2019 via email

Copy link
Copy Markdown
Contributor Author

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.

3 participants