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

Suggestion: return temperature as int #11

Open
wolfbert opened this issue Oct 10, 2019 · 0 comments
Open

Suggestion: return temperature as int #11

wolfbert opened this issue Oct 10, 2019 · 0 comments

Comments

@wolfbert
Copy link

wolfbert commented Oct 10, 2019

Hi, playing around with the library I noticed that the temperature is returned as a float (as in other DS3231 libraries). If the method is used, this pulls in floating point code that would otherwise be unneeded.

The datasheet lists the temperature accuracy as +/-3° Celsius @ 3.3V, yet the temperature is internally represented in units of 0.25°. Given that, wouldn't it make sense to integer divide by 4/round and return an int8_t? In a small example, this resulted in upwards of 800 bytes less flash memory. The tradeoff is that tiny trends would only be detectable after a change of 0.5°, and that the interface would not totally show the internal status of the chip.

Not a big deal, given that the temperature method will probably not be widely used, just my 2 cents.

Edit: Such a version could be provided by means of an additional configuration switch ENABLE_*.

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