Skip to content

Negative temps #45

@srroys58

Description

@srroys58

The code to handle negative temperatures reported by a DHT22/RHT03 sensor (flagged by a high bit 16):

if (temp & 0x8000) {
temp = (~temp & 0xffff) + 1;
}

gives large positive numbers for temperatures less than 0C (ex: 0x8005 = -5 gives 0x7ffb = 32763).

temp = -(temp & 0x7fff); Works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions