Comments (13)
Hmmm. you are right concerning the file size. With or without noInterrupts() it is the same.
I use two DHT22.
I am using also ESP32 package (1.0.6).
Just running new tests. They take a while. An error appearance is easy to see. A non appearance takes more time to be sure.
I am running the reading loop every 5 seconds. The error affects both sensors and appear randomly.
Actual test is running with the original library:
Always error -4 after an average of about 70 readings in a test of about 700 readings. Distributed about 50/50 between the sensors.
Now running test with your first version and afterwards I'll do the test with the actual development version and I will comment...
from dhtnew.
Thanks for reporting this issue. The solution you propose sounds interesting and I need to investigate. Might take a few days as I am quite busy.
from dhtnew.
A first look in the ESP32 package (1.0.6) shows in Arduino.h:
#define sei()
#define cli()
#define interrupts() sei()
#define noInterrupts() cli()
so it looks like the noInterrupts() is doing nothing on ESP32, so it will not help.
I will make a develop branch to fix the issue.
from dhtnew.
Develop branch created - https://github.com/RobTillaart/DHTNew/tree/develop
PR is building.
@willy2764
Please give it a try if you have time
from dhtnew.
@RobTillaart
Just trying it. Interesting, your modification also gives errors from time to time.
If I change the code as follows, leaving the "noInterrupts()" command in, I don't get anymore errors
#if defined(ESP32)
portDISABLE_INTERRUPTS();
#endif
noInterrupts();
respectively
#if defined(ESP32)
portENABLE_INTERRUPTS();
#endif
interrupts();
So, seems that both commands are needed for the ESP32.
from dhtnew.
interesting result, as noInterrupts() is defined as an empty statemen,
test compiling minimal sketch for UNO with and without noInterrupts() differs 4 bytes.
For ESP32 with and without noInterrupts() differs 0 bytes.
If my test (and theory) is correct you should get also the same file size with your sketch,
Can you check that?
I do not understand why inserting noInterrupts() (nothing) in your proposal solves the problem.
How often (approx) does the failure pops up?
1 in 10, 1 in 100, 1 in 1000?
from dhtnew.
Q: which DHT sensor do you use?
from dhtnew.
Note: I updated the develop branch code to your proposal but still do not understand why it should work.
from dhtnew.
Now since about 2h running the test. No error.
Probably I mixed something up on the last trials.
So, your first developement version excluding the noInterrupts() command for the ESP32 seems fine.
from dhtnew.
Ok, will check code again later.
Please let me know if you find a cause.
from dhtnew.
The root cause. That's easy. Somewhere between my ears..... :-)
from dhtnew.
I reverted to the first version, build is running,
will merge tomorrow unless new problems pop up.
from dhtnew.
Merged into 0.4.13
from dhtnew.
Related Issues (20)
- Still problems with measuring negative values (AM2301) HOT 4
- Sensors getting stuck at a certain value HOT 37
- Fix negative temperature below -25.5°C HOT 1
- Humidity values higher than 100% HOT 17
- F_CPU not defined for Arduino Nano RP2040 Connect HOT 3
- read() hangs with MkrWiFi + MkrConnector Board HOT 66
- DTH11 gets too short start impulse HOT 16
- setTempOffset and setHumOffset HOT 3
- Support for SonOff Si7021 HOT 10
- Test sketch HOT 4
- Si7021 by Sonoff HOT 16
- DHT22 registers as type 70 in 0.4.14 HOT 12
- Support for DS18B20 HOT 3
- Sonoff Si7021 gives wrong temperature and humidity HOT 5
- Compiler warning, conversion float to double HOT 7
- Ticker compatibility HOT 12
- Add support for the AM2320, AM2321 and AM2322.
- consider an enhancement to be able to compile this lib directly under espressif/platformio without Arduino layer HOT 4
- Parallel processing of multiple Sensors HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhtnew.