-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Negative temperatures #14
Comments
Nop, I didn't test it. I'll try it in our refrigerator. |
Here is the code I'm using to work around this issue. As I'm sending the data over BLE to an Android phone and the USB port of the ESP32 NodeMCU broke off (I'm using the library with that), making an on-device correction somewhat more laborious, i fixed it in the app which receives the data. Before sending it to the phone I multiply with 100 and then cast to int, that makes the BLE decoding somewhat easier. In the app I'm using the following to correct the issue:
|
Hi, solution si:
in function SimpleDHT22::read2 and I changed all datatype short to uint16_t but datatype is may not a reason of problem. |
Could u please file a PullRequest? |
I will look into it |
BTW, using a compressed gas duster (holding it upside down) can give you temps below the freezing point very quickly, then you can heat it up again with the fingers. |
This commit fixes issue winlinvip#14 The MSB carries the sign information, which is filtered with `& 0x8000`. If the flag is present, the remainder will get multiplied by `-1`. All the remaining bits contain the value and are filtered with `& 0x7FFF`.
This commit fixes issue #14 The MSB carries the sign information, which is filtered with `& 0x8000`. If the flag is present, the remainder will get multiplied by `-1`. All the remaining bits contain the value and are filtered with `& 0x7FFF`.
Merged |
Please fix it for DHT11. |
I don't have a DHT11 to test with. But since the DHT11 only works with temperatures equal to or above 0 °C, I think that sign flag never gets set. I preferred not to touch that code. |
👌 |
Unfortunately still not displayed correctly :/ |
@mapmelad on what device are you running it? For me this works on an ESP32, maybe this is device dependent? When you use a previous commit, what does it show? |
First, I obtained the values of the similarity -3277.0°C.
Then, after the fix I started getting the values 255, 254 and so on |
Maybe this is due to the ArduinoBT -- which you're apparently using, judging from the screenshot -- being an 8 bit mcu while the ESP32 has a 32 bit cpu. |
Should we reopen this issue? @danielfaust |
Please test 1.0.9 |
Have you tested this library with negative temperatures?
With a DHT22 I'm getting values like -3276.3°C for values slightly below 0°C (possibly for -0.7°C).
-3277.0°C is not reached, that one is then 0.0°C
The text was updated successfully, but these errors were encountered: