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