Skip to content

Commit

Permalink
Merge pull request #2 from flrrth/byte_2_bit-shift
Browse files Browse the repository at this point in the history
Fix bit shifting
  • Loading branch information
flrrth authored Nov 13, 2022
2 parents 83f84b2 + 0b53280 commit 90540b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dht20/dht20.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def measurements(self) -> dict:
retry -= 1

buffer = data[0]
s_rh = buffer[1] << 12 | buffer[2] << 8 | buffer[3] >> 4
s_rh = buffer[1] << 12 | buffer[2] << 4 | buffer[3] >> 4
s_t = (buffer[3] << 16 | buffer[4] << 8 | buffer[5]) & 0xfffff
rh = (s_rh / 2 ** 20) * 100
t = ((s_t / 2 ** 20) * 200) - 50
Expand Down

0 comments on commit 90540b7

Please sign in to comment.