Updates idDHT11.cpp to differentiate between timeouts

Creates three different error codes instead of a single code for three timeout possibilities.
This commit is contained in:
Alex Gutowski 2013-10-28 00:54:06 -05:00
parent 56cfe7e0bd
commit e2769e3a7e

View File

@ -67,7 +67,7 @@ void idDHT11::isrCallback() {
int delta = (newUs-us);
us = newUs;
if (delta>6000) {
status = IDDHTLIB_ERROR_TIMEOUT;
status = IDDHTLIB_ERROR_ISR_TIMEOUT;
state = STOPPED;
detachInterrupt(intNumber);
return;
@ -81,7 +81,7 @@ void idDHT11::isrCallback() {
state = DATA;
} else {
detachInterrupt(intNumber);
status = IDDHTLIB_ERROR_TIMEOUT;
status = IDDHTLIB_ERROR_RESPONSE_TIMEOUT;
state = STOPPED;
}
break;
@ -114,7 +114,7 @@ void idDHT11::isrCallback() {
} else cnt--;
} else {
detachInterrupt(intNumber);
status = IDDHTLIB_ERROR_TIMEOUT;
status = IDDHTLIB_ERROR_DATA_TIMEOUT;
state = STOPPED;
}
break;
@ -176,4 +176,4 @@ double idDHT11::getDewPointSlow() {
double T = log(VP/0.61078); // temp var
return (241.88 * T) / (17.558-T);
}
// EOF
// EOF