-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fixed getRawTemperature and getRawHumidity #11
Conversation
The internal variables that the raw values are read from were swapped.
Thanks for catching this bug |
Looks like I was somewhere completely else with my mind when writing this code. |
Happens to the best of us 😉 Have a nice sunday :) |
If they are this obvious one has no choice 😁 |
Triggered by your PR a new 0.2.0 release is prepared. See the develop branch
If you have time to test with real hardware, would be appreciated. (especially resolution) update: example added (loop over resolutions, should give all same temp and hum +- noise) |
The only hardware I've got is a HTU21D connected to an ESP32 devboard using its 3.3v to supply the sensor. I've downloaded the current dev branch with 0.2.0 and ran the SHT2x_resolution.ino sketch. I can confirm, that the temperature and humidity readings are the same for each resolution setting +-noise. Always glad to help :) UPDATE: |
Thanks for testing, I will dive into the datasheets tomorrow to check for diffs. The EIDA is less important than the setresolution. |
updated the develop with crc8 test in the read() |
I read several datasheets and they look pretty the same. update: fixed, but needs another round of testing. If you have time for testing, can you post the output of SHT2x_resolution.ino? |
Output from SHT2x_resolution.ino from latest develop:
|
Thanks, i notice the timing is still hard-coded. |
Just pushed a change with adjusted timing for the different resolutions. (based upon table 7 SHT21) Please rerun the test sketch. If it is OK, I am going to merge it into master and release version 0.2.0 |
Output from latest develop:
I noticed, that the humidity value only ever changed after resetting the resolution setting to 0 while staying the same throughout the for loop. During investigating your code if there might be some hidden reason, I noticed the different delays based on the resolution setting (if else if...) and was wondering why for temperature it was 3 then 1 then 2 but for humidity 1 then 2 then 3. Otherwise I foresee someone in the future trying to "fix" this code but actually breaking correctness. Anyways, thanks for your work :) |
Thanks for testing, |
The expected times versus the measured times
So only the resolution == 0 meets the expectation. Which processor do you use? What I do notice is that the sensor gives 4x the same temperature in a row. I am going to rewrite the example. Example updated
|
I've used an ESP32 which is known to not be very precise with its delays... I now used an Arduino Nano with the latest develop version.
|
Looks better than last test but still most are longer than expected. |
Always glad to help. |
Note: that the timing in the last test is very similar per resolution MINUS 1 second ... |
Released 0.2.0 |
The internal variables that the raw values are read from were swapped.