Skip to content

Commit 02cc2c5

Browse files
committed
fix issue with delayMicroseconds > 16000
1 parent 4a301a8 commit 02cc2c5

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

libraries/DHTlib/dht.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
//
22
// FILE: dht.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.21
4+
// VERSION: 0.1.22
55
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
66
// URL: http://arduino.cc/playground/Main/DHTLib
77
//
88
// HISTORY:
9+
// 0.1.22 undo delayMicroseconds() for wakeups larger than 8
910
// 0.1.21 replace delay with delayMicroseconds() + small fix
1011
// 0.1.20 Reduce footprint by using uint8_t as error codes. (thanks to chaveiro)
1112
// 0.1.19 masking error for DHT11 - FIXED (thanks Richard for noticing)
@@ -123,7 +124,8 @@ int8_t dht::_readSensor(uint8_t pin, uint8_t wakeupDelay, uint8_t leadingZeroBit
123124
// REQUEST SAMPLE
124125
pinMode(pin, OUTPUT);
125126
digitalWrite(pin, LOW); // T-be
126-
delayMicroseconds(wakeupDelay * 1000UL);
127+
if (wakeupDelay > 8) delay(wakeupDelay);
128+
else delayMicroseconds(wakeupDelay * 1000UL);
127129
digitalWrite(pin, HIGH); // T-go
128130
pinMode(pin, INPUT);
129131

@@ -196,4 +198,4 @@ int8_t dht::_readSensor(uint8_t pin, uint8_t wakeupDelay, uint8_t leadingZeroBit
196198
}
197199
//
198200
// END OF FILE
199-
//
201+
//

libraries/DHTlib/dht.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: dht.h
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.21
4+
// VERSION: 0.1.22
55
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
66
// URL: http://arduino.cc/playground/Main/DHTLib
77
//
@@ -19,7 +19,7 @@
1919
#include <Arduino.h>
2020
#endif
2121

22-
#define DHT_LIB_VERSION "0.1.21"
22+
#define DHT_LIB_VERSION "0.1.22"
2323

2424
#define DHTLIB_OK 0
2525
#define DHTLIB_ERROR_CHECKSUM -1

libraries/DHTlib/library.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,13 @@
22
"name": "DHTlib",
33
"keywords": "DHT11 DHT22 DHT33 DHT44 AM2301 AM2302 AM2303",
44
"description": "Optimized Library for DHT Temperature & Humidity Sensor on AVR only.",
5-
"authors":
6-
[
7-
{
8-
"name": "Rob Tillaart",
9-
"email": "Rob.Tillaart@gmail.com",
10-
"maintainer": true
11-
}
12-
],
135
"repository":
146
{
157
"type": "git",
168
"url": "https://github.com/RobTillaart/Arduino.git"
179
},
1810
"frameworks": "arduino",
19-
"platforms": "atmelavr",
11+
"platforms": "*",
2012
"export": {
2113
"include": "libraries/DHTlib"
2214
}

libraries/DHTlib/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=DHTlib
2-
version=0.1.21
2+
version=0.1.22
33
author=Rob Tillaart <rob.tillaart@gmail.com>
44
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
55
sentence=Optimized Library for DHT Temperature & Humidity Sensor on AVR only.

0 commit comments

Comments
 (0)