Skip to content

Negative temps #45

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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