From 4a2747f0c508cd5af830c14e43ffeaf3fe25e4e7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 8 Aug 2018 08:17:23 +0200 Subject: am2320: Fix typo and remove superfluous bitmask --- src/driver/am2320.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/driver') 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.; -- cgit v1.2.3