-
Notifications
You must be signed in to change notification settings - Fork 132
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
Refactor all frequencies from MHz (double) to Hz (uint32_t) #179
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #179 +/- ##
========================================
Coverage 77.66% 77.66%
========================================
Files 66 66
Lines 6831 6833 +2
========================================
+ Hits 5305 5307 +2
Misses 1526 1526 ☔ View full report in Codecov by Sentry. |
Codecov fails because the test coverage of changed lines is subpar to the overall coverage of the module. I'll try to add some tests to fix this while we are at it. |
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.
a few variables seem to be still double
Thank you, I must have missed them. I'll check everything again. |
@pagmatt if you agree, before merging this I'd like to both merge #180 and the tests required to cover the lines indicated by codecov (I have yet to create a PR for this). It feels the right order of actions given the dependency of changes bug<-tests<-this. Afterwards I'll take care of merging changes. |
In the LoRaWAN MAC protocol specifications, in the LoRa devices PHY hardware abstraction layer libraries, in the gateways' packet forwarder protocol code and in the network server configurations and internal representation, frequency values are encoded using 4 bytes (and in Hz). However, the module currently uses MHz values in floating point form to represent frequencies.
Aligning with real implementations slightly simplifies encoding and prevent floating point arithmetic issues. From personal experience, I once got a bug because multiplying
frequency * 0.01
instead offrequency / 100
returned a.99999999
-like value, and as a consequence all comparisons to retrieve the correctLogicalLoraChannel
object yieldedfalse
.This PR converts the type of frequency values used throughout the module from
double
touint32_t
, and it appendsHz
to names of class members and function signature parameters representing frequencies (i.e. ending up in the API documentation).This PR is an effort to break #135 into more digestible pieces.