Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safer calls to setGainMode #701

Merged
merged 1 commit into from
Mar 15, 2019
Merged

Safer calls to setGainMode #701

merged 1 commit into from
Mar 15, 2019

Conversation

drahosj
Copy link
Contributor

@drahosj drahosj commented Jan 14, 2019

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

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
Copy link
Contributor Author

drahosj commented Jan 14, 2019

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
Copy link
Contributor Author

drahosj commented Jan 14, 2019

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
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
Copy link
Contributor Author

drahosj commented Mar 15, 2019 via email

@drahosj
Copy link
Contributor Author

drahosj commented Mar 15, 2019 via email

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