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

Library with floats too large, _lastUVA, _lastUVB should be unsigned int #8

Open
bootchk opened this issue Apr 16, 2020 · 0 comments
Open

Comments

@bootchk
Copy link

bootchk commented Apr 16, 2020

I tried to compile for MSP430 (using Energia, a clone of Arduino IDE.) It fails to fit into memory unless you comment out all the float stuff. It would be nice if the library could be broken into two pieces: one that reads the raw values, and the float stuff that calculates UV index.

_lastUVA, _lastUVB are declared float but should be unsigned int? That is, I think they should be named _lastRawUVA and _lastRawUVB, the device yields 16-bit unsigned ints, and your code seems to assign unsigned ints to these variables, at which time an implicit float conversion is done.
This could be related to the issue #2 of values going negative. If the raw values are large so the MSB bit is set, then they are interpreted as negative numbers during the float conversion?

I could be wrong, I have only briefly looked at the code.

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

No branches or pull requests

1 participant