diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-08-08 08:17:23 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-08-08 08:17:23 +0200 |
commit | 4a2747f0c508cd5af830c14e43ffeaf3fe25e4e7 (patch) | |
tree | bb9895d8dca427695b6d7afe6eddd71834cfc858 /src | |
parent | 4f09b621e12e5ecf5b34396a36556a8dca49e8cd (diff) |
am2320: Fix typo and remove superfluous bitmask
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/am2320.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/driver/am2320.cc b/src/driver/am2320.cc index 25e2ffe..532fdb6 100644 --- a/src/driver/am2320.cc +++ b/src/driver/am2320.cc @@ -39,7 +39,7 @@ unsigned char AM2320::getStatus() } } } - if ((rxbuf[6] != (checksum & 0x00ff)) || (rxbuf[7] != (checksum >> 8) & 0x00ff)) { + if ((rxbuf[6] != (checksum & 0x00ff)) || (rxbuf[7] != (checksum >> 8))) { return 3; } return 0; @@ -47,7 +47,7 @@ unsigned char AM2320::getStatus() float AM2320::getTemp() { - if (txbuf[5] & 0x80) { + if (rxbuf[5] & 0x80) { return (-256 * (rxbuf[4] & 0x7f) + rxbuf[5]) / 10.; } return (256 * rxbuf[4] + rxbuf[5]) / 10.; |