-
Notifications
You must be signed in to change notification settings - Fork 415
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
[SX126x] Add method to support SX126x Rx Boosted Gain mode #663
[SX126x] Add method to support SX126x Rx Boosted Gain mode #663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! I left some minor comments. In addition, please add setRxBoostedGainMode
as keyword to keywords.txt (keep in mind this file has to use true tabs, not spaces).
Regarding restoring non-retention of Rx gain, did you investigate what is the default value of the RADIOLIB_SX126X_REG_RX_GAIN_RETENTION_X
registers? And does it change upon power-on reset?
src/modules/SX126x/SX126x.h
Outdated
|
||
\returns 0 | ||
*/ | ||
int16_t setRxBoostedGainMode(bool rxbgm = false, bool retain = false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to remove the first default argument - it doesn't seem to make much sense to call setRxBoostedGainMode()
, why is false
the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yep agreed, defaulting this to false does not make sense – removed.
2f15aac
to
f885d58
Compare
Awesome, thanks for the feedback! Made the changes you requested. Re: retention of Rx gain setting, I was unable to find any other information about the three registers mentioned in the datasheet. I just did some more testing locally, and observed that the value of the first retention register is always 0 on startup, but the values of the other two fluctuate and do not seem to have consistent defaults. But moreover, I was actually not able to get Rx gain retention working at all with my test device (a RAK4631 running Meshtastic 2.0.13). Upon sleep/warm start, the value in the Rx gain setting register is always 0x94, regardless of whether the retention registers were set. (I guess this might be a result of particularities in the way Meshtastic handles sleep, but it is also quite possible I am misunderstanding something in the datasheet or code.) In light of the above, maybe it would be better to keep things simple and drop the 'retain' argument and functionality for now? |
In that case, let's drop it - I would rather not have this functionality, than have something that maybe works, maybe doesn't and might have some unknown side effects. You could try asking on the LoRa developer forum (https://forum.lora-developers.semtech.com/c/Semtech-Transceivers/SX126x-family/29), maybe somebody from Semtech will be kind enough to help. |
…Boosted Gain mode
f885d58
to
35ed685
Compare
Ok sounds good, removed 'retain' arg and functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, in that case this is good to merge.
... and done! Thank you very much for the contribution! |
I know this PR is old and done. @andrew-moroz what is the purpose of this method other whats on the method? in other words, where and how enabling this option (i.e., gain mode) would increase the RX sensitivity? I am currently looking for ways to increase sensitivity (apart from working on LNA and antenna setup) thank you! |
This adds a method allowing SX126x radios to be toggled between Rx Boosted Gain and Rx Power Saving Gain (the default setting) as described in section 9.6 of the SX126x datasheets. It also optionally allows the gain mode setting to be persisted across sleep/warm start.
I wasn't sure if perhaps it would be preferable to break the 'retain' argument (whether to persist the selected Rx gain setting) out into its own setter. I stopped short of doing that here, partly because the datasheet does not say anything specific about how to revert to not persisting (though the implication seems to be that if the gain retention registers are set to any values other than those specified, the gain setting will not be retained). But, happy to refactor if needed.