Browse Source

Using delay instead of delayMicroseconds on DHT warmup delay

i18n
Xose Pérez 6 years ago
parent
commit
b9e158efe4
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      code/espurna/sensors/DHTSensor.h

+ 5
- 1
code/espurna/sensors/DHTSensor.h View File

@ -137,7 +137,11 @@ class DHTSensor : public BaseSensor {
pinMode(_gpio, OUTPUT); pinMode(_gpio, OUTPUT);
noInterrupts(); noInterrupts();
digitalWrite(_gpio, LOW); digitalWrite(_gpio, LOW);
delayMicroseconds(_type == DHT_CHIP_DHT11 ? 20000 : 500);
if (_type == DHT_CHIP_DHT11) {
delay(20);
} else {
delayMicroseconds(500);
}
digitalWrite(_gpio, HIGH); digitalWrite(_gpio, HIGH);
delayMicroseconds(40); delayMicroseconds(40);
pinMode(_gpio, INPUT_PULLUP); pinMode(_gpio, INPUT_PULLUP);


Loading…
Cancel
Save