feat: Add SNR calculation functionality (Int & Float)#17
Open
ArshiaMadadii wants to merge 2 commits intoSMotlaq:masterfrom
Open
feat: Add SNR calculation functionality (Int & Float)#17ArshiaMadadii wants to merge 2 commits intoSMotlaq:masterfrom
ArshiaMadadii wants to merge 2 commits intoSMotlaq:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Functionality Implemented
This PR adds support for reading the Signal-to-Noise Ratio (SNR) of the last received packet, which is critical for evaluating link quality in LoRa communications.
The implementation reads from the
RegPktSnrValue(0x19) register. Since the SX127x module reports SNR in 0.25dB steps using a signed 2's complement format, I implemented logic to correctly handle negative values (common in long-range transmission).Outputs
I have added two functions to offer flexibility between precision and performance:
LoRa_getSNR_x4(LoRa* _LoRa)int16_t-50corresponds to-12.5 dB.LoRa_getSNR(LoRa* _LoRa)float-12.5