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

Fix negative temperature in ds18x20 driver #2582

Closed
wants to merge 1 commit into from

Conversation

ernitron
Copy link
Contributor

@ernitron ernitron commented Oct 31, 2016

As per discussion on this forum thread http://forum.micropython.org/viewtopic.php?f=16&t=2564#p15232
I think there is a bug in Onewire ds18x20 driver with negative temperatures.

The proposed fix is just for Dallas temperature sensors of 0x28 class. I have no possibility to check for 0x10 but I guess there is a similar issue with negative values.

Fix has been tested and provide correct results for negative temperatures. Code was derived from similar code working for Arduino.

@dpgeorge
Copy link
Member

dpgeorge commented Nov 2, 2016

Thanks! Merged in e5f0655 with a few tweaks: removed the return -(t/16) line and changed the t=... line before it to include the negative; changed 16.0 to 16 because that's more efficient in the bytecode and produces the same result.

I couldn't test it but I assume it works.

I have no possibility to check for 0x10 but I guess there is a similar issue with negative values.

No, I think that version of the device is ok, it seems to have a check for negative numbers already.

@dpgeorge dpgeorge closed this Nov 2, 2016
tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Feb 5, 2020
…tuple

allow tuple or list for Palette color
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

Successfully merging this pull request may close these issues.

None yet

2 participants