Skip to content
Snippets Groups Projects
Commit 4a2747f0 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

am2320: Fix typo and remove superfluous bitmask

parent 4f09b621
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,7 @@ unsigned char AM2320::getStatus() ...@@ -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 3;
} }
return 0; return 0;
...@@ -47,7 +47,7 @@ unsigned char AM2320::getStatus() ...@@ -47,7 +47,7 @@ unsigned char AM2320::getStatus()
float AM2320::getTemp() float AM2320::getTemp()
{ {
if (txbuf[5] & 0x80) { if (rxbuf[5] & 0x80) {
return (-256 * (rxbuf[4] & 0x7f) + rxbuf[5]) / 10.; return (-256 * (rxbuf[4] & 0x7f) + rxbuf[5]) / 10.;
} }
return (256 * rxbuf[4] + rxbuf[5]) / 10.; return (256 * rxbuf[4] + rxbuf[5]) / 10.;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment