Closed berkowski closed 4 years ago
ahh whoops 🙃 thanks for the issue! iirc i changed this so behaviour was consistent with the semtech c driver so they interoperated more sensibly, could either use libm or truncate and check if the delta is > 5 to achieve the same outcome? (and either would be cool with me)
I created a fix just for my own testing that used libm
that seems to work. However, to do so I added new feature to the crate ("no-std") instead of testing against the absence of all of the existing features ("util", "serde", etc.). I'm not sure that's the right way forward but at least it confirmed that the issue is confined to these few lines.
I think truncation would be better if they're equivalent as far as the radio goes. Less complicated and more consistent across platforms.
to do so I added new feature to the crate ...
not that it matters at all for testing, but fyi one of the reasons to be careful of this is that there are a few situations in which cargo will union feature flags ^_^
I think truncation would be better if they're equivalent as far as the radio goes.
seems reasonable to me! I'd be happy to accept a PR if you'd like to open one, or can have a go at this later.
Yeah, adding a "no-std" feature was just a quick hack to try the libm
conditional stuff. I'll make up a quick PR with a one-off rounding function in a moment.
The crate fails to build with default features disabled (as required for use in
no_std
crates):Last working tag appears to be
0.7.4
, where plain integer truncation was used for fdev and datarate, e.g.If rounding is absolutely required it can be provided by the
libm
crate with some compile-time configuration.