Skip to content

Temperatures over 42.5 C are coming back as negative #4

Closed
@mshannon78660

Description

@mshannon78660

Temperatures higher than 42.5 degress C (108.5 degrees F) are coming back as very large negative numbers. I think this is due to line 198 (

raw_temp = unpack_from(">h", temp_data)[0]
) unpacking the measurement as a signed short - I think it should be unsigned, just like with relative humidity. So that line would change from
raw_temp = unpack_from(">h", temp_data)[0]
to
raw_temp = unpack_from(">H", temp_data)[0]

In the next line, we're already subtracting 4500 from the value, which is how we get to negative temperatures. Looking at the Arduino library, it looks like they use the value as unsigned:
https://github.com/adafruit/Adafruit_SHTC3/blob/8d48fd2708027c0f943743077f3fbae8b51a9f29/Adafruit_SHTC3.cpp#L159

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions