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

setCodingRate logic incorrect #6

Open
rgillan opened this issue Dec 27, 2017 · 1 comment
Open

setCodingRate logic incorrect #6

rgillan opened this issue Dec 27, 2017 · 1 comment

Comments

@rgillan
Copy link

rgillan commented Dec 27, 2017

Hi,
Great work on this, saved me a lot of time coding this up. Noticed that when setting the coding rate in the options it wasn't being set in the sx1276 correctly, so went digging. In the logic in SX127x.prototype.setCodingRate you are comparing the effective number set (4/5 or 0.8, 4/6 or 0.66 etc.). Your testing has the sequence backwards, and it will always result in 4/5 or denominator 5. The code should be

if (cr <= (4/8)) { denominator = 8; } else if (cr <= (4/7)) { denominator = 7; } else if (cr <= (4/6)) { denominator = 6; } else { denominator = 5; }
I've checked the register settings for all 4 coding rates and they are correct with the above changes.

@sandeepmistry
Copy link
Owner

Hi @rgillan, could you please submit a pull request for the suggested changes. Thanks.

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

No branches or pull requests

2 participants