-
Notifications
You must be signed in to change notification settings - Fork 2k
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
drivers/sx127x: reduce use of floats #19697
Conversation
The original Semtech pkg hardcoded this information in the driver. In practice it doesn't make sense, as it is specific to the MAC config and has nothing to do with the transceiver. |
Agreed. But I don't think we need to deprecate this before removing as I see this as an internal API. Would you mind to PR this? I can rebase the channel computation on top of that. |
6e65a3a
to
a6ffbd0
Compare
I updated this now to only do the straight forward conversions in the hope that the airtime computation is about to get dropped anyway. |
Let's just merge this one then. I realized the |
It still needs ACK, though 😉 |
sure, I would just like to test it before |
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.
ACK. The new function yields the same values as the float version.
I noticed that this function seems to overestimates the ToA for low pkt_len values. But this was already the case with the float
version and it shouldn't be a problem for LoRaWAN
sys/include/net/lora.h
Outdated
/** @brief Frequency resolution in Hz */ | ||
#ifndef LORA_FREQUENCY_RESOLUTION_DEFAULT | ||
#define LORA_FREQUENCY_RESOLUTION_DEFAULT (61.03515625) | ||
/** @brief Frequency resolution in nano Hz */ |
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.
you may want to add to comment this is 32MHz/2^19
a6ffbd0
to
826095d
Compare
I added the comment @kfessel suggested and the white space changes uncrustify preferred. (So only white space changes from a C compiler's point of view since the last testing.) Should be good to go now. |
bors merge |
bors merge |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Contribution description
Convert the floating point arithmetic to integer arithmetic.
Beware: I neither tested this nor did I try to understand the calculations.
Testing procedure
Issues/PRs references
#19614