adafruit / adafruit/Adafruit_CircuitPython_LPS35HW

Negative temperature unsigned integer issue

Open
#7 2 comments 0 reactions 1 assignee Claimed by @siddacious View on GitHub
Dominant language
Python
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I've seen some weird behavior with my sensor when it dips below freezing (< 32 deg F, < 0 deg C) whereby the temperature reading is around 654 C and less. After posting this issue to the Adafruit forum, a support member suggested it was an unsigned integer problem. Since temperature register in the device is a 16 bit 2's complement value in 100ths of a degree. A temperature of -1C would be stored in binary as 1111 1111 1001 1100. Interpreted as a signed integer that is -100. As an unsigned integer it would be 65436. Since the library takes the contents of the register and divides by 100 - which results in the 654 that I am seeing.

Is it possible to fix this library bug?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.