Skip to content
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

Core 1 panic'ed (Interrupt wdt timeout on CPU1) on ESP32 #218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions DHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ bool DHT::read(bool force) {
for (int i = 0; i < 80; i += 2) {
cycles[i] = expectPulse(LOW);
cycles[i + 1] = expectPulse(HIGH);

if (cycles[i] == TIMEOUT || cycles[i + 1] == TIMEOUT) {
DEBUG_PRINTLN(F("DHT timeout waiting for data signal."));
_lastresult = false;
return _lastresult;
}
}
} // Timing critical code is now complete.

Expand All @@ -312,11 +318,7 @@ bool DHT::read(bool force) {
for (int i = 0; i < 40; ++i) {
uint32_t lowCycles = cycles[2 * i];
uint32_t highCycles = cycles[2 * i + 1];
if ((lowCycles == TIMEOUT) || (highCycles == TIMEOUT)) {
DEBUG_PRINTLN(F("DHT timeout waiting for pulse."));
_lastresult = false;
return _lastresult;
}

data[i / 8] <<= 1;
// Now compare the low and high cycle times to see if the bit is a 0 or 1.
if (highCycles > lowCycles) {
Expand Down
Loading