未验证 提交 ca709850 编写于 作者: L Laurent Ellerbach 提交者: GitHub

Fixing DHT22 temperature measurement not correct (#1008)

上级 181c930c
......@@ -29,7 +29,7 @@ namespace Iot.Device.DHTxx
internal override Temperature GetTemperature(byte[] readBuff)
{
var temp = (readBuff[2] & 0x7F) + readBuff[3] * 0.1;
var temp = ((readBuff[2] & 0x7F) * 256 + readBuff[3]) * 0.1;
// if MSB = 1 we have negative temperature
temp = ((readBuff[2] & 0x80) == 0 ? temp : -temp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册