Commit Graph

38 Commits

Author SHA1 Message Date
Piotr Henryk Dabrowski
bd145c5449 Use const instead of defines for sensors types 2021-10-21 10:39:47 +02:00
per1234
86115884c7 Make preprocessor conditional false when identifier undefined
A preprocessor conditional directive intended to only evaluate as true when compiling for the Arduino Nano 33 BLE board
was also evaluating as true when compiling for any board that didn't define the compared identifiers because undefined
identifiers are replaced with 0 by the C/C++ preprocessor, making them equal.

From the C++11 standard section 16.1, paragraph 4:

> After all replacements due to macro expansion and the defined unary operator
have been performed, all remaining identifiers and keywords 148 , except for true and false, are replaced
with the pp-number 0

The fix is to modify the directive to check whether the macro has been defined.
2020-12-01 17:53:54 -08:00
Tom Petz
f0a66b0dd3 Adjust comments to comply with doxygen. 2020-09-08 16:12:02 -04:00
Tom Petz
b504fa540e fix extra space and end of line 2020-09-08 14:48:08 -04:00
Tom Petz
fa22bc6ca4 Fix lint errors 2020-09-08 14:41:40 -04:00
Tom Petz
a1f0c1c038 Add missing microsecondsToClockCycles for 33 BLE 2020-09-08 13:57:07 -04:00
siddacious
5d60b0d3f0 actionified, formatted and doxy'd 2020-04-08 11:37:24 -07:00
Jan Hoffmann
dd455428a0 documented DHT 2019-07-04 17:06:42 +02:00
Phillip Burgess
f566d58f47 Move ESP8266 yield() out of InterruptLock 2019-02-18 10:20:28 -08:00
Phillip Burgess
9bf12551d8 ESP8266: yield() immediately before & after interrupt disablage 2019-02-14 09:27:28 -08:00
Phillip Burgess
7cec0cb06d Configurable pullup delay time, default 55 usec 2019-02-14 09:24:17 -08:00
Paint Your Dragon
be8859e28c
Merge pull request #113 from gpambrozio/master
Making the library work nicely with the nrf52
2019-01-11 16:34:03 -08:00
Paint Your Dragon
bf86a4068c
Merge pull request #112 from SConaway/patch-1
Read Temp and Humidity if not specified
2019-01-11 16:33:11 -08:00
Paint Your Dragon
efcca31a7f
Merge pull request #108 from qub1750ul/master
Use bool instead of boolean
2019-01-11 16:23:45 -08:00
Gustavo Ambrozio
7787bdd186 Making the library work nicely with the nrf52 2018-08-14 13:44:40 -06:00
Steven Conaway
f771939337
Update DHT.h 2018-07-30 11:27:30 -07:00
Giuseppe Masino
3bba771f8c Changed boolean to bool 2018-06-27 19:18:17 +02:00
Boyi C
a607a50475 Add support for DHT12.
Change DHT11 temperature resolution to 0.1 instead of 1.
2017-12-12 14:20:26 +08:00
Tony DiCola
15020aa891 Fix #44 by conditionally excluding unused port and bitmask state on non-AVR platforms. 2015-10-12 21:30:01 -07:00
Matthijs Kooijman
45a20da301 Shrink DHT::data to 5 bytes
There's only 5 bytes of data being transferred (2x2 bytes of data, 1
byte checksum), so no need to keep a useless byte.
2015-07-24 21:43:52 +02:00
Matthijs Kooijman
5973929e63 Remove the firstreading variable
By cleverly setting _lastreadtime in begin() to make sure that it looks
like the last read was alrady 2000 ms ago, even on startup when millis()
still returns 0, there is no longer a need to keep a separate
firstreading variable, saving a byte of memory and a bit of code.
2015-07-24 21:42:58 +02:00
Matthijs Kooijman
04905bc5cd Add force parameter to read methods
This allows forcing a read, even if the previous read was less than 2
seconds ago. This is useful in cases where the millis() timer is not
reliable, such as when sleeping. In this case, it is up to the caller to
ensure that at least 2 seconds elapse between calls with force set to
true.
2015-07-24 21:40:22 +02:00
Tony DiCola
5cd78aead6 Fix merge conflict with interrupt disable lock. 2015-07-22 12:22:35 -07:00
Tony DiCola
85d85170bd Fix #37 by optimizing pulse read to use direct port access on AVR, stops checksum failures from missed signals. 2015-07-22 12:13:56 -07:00
Zirientis
a2208eb813 Cause interrupts to be reenabled if a timeout occurs while waiting for the sensor. 2015-07-01 17:58:17 -07:00
Tony DiCola
ef9590ad96 Fix merge conflicts, make compute heat index default to Fahrenheit to not break old code that assumes default is Fahrenheit. 2015-06-26 15:56:04 -07:00
Tony DiCola
9d7a9da8ae Refactor algorithm to dynamically adjust to faster/slower processors. Fix #35 #30. 2015-06-26 15:14:17 -07:00
Igor Scheller
25942ac8b9 Added support for Celsius in computeHeatIndex 2014-11-01 12:27:16 +01:00
Tony DiCola
7f7425f11e Resolve #24 by adding convert F to C function. 2014-07-25 19:34:35 -07:00
Tony DiCola
9611395a77 Switch to use noInterrupts and interrupts function. make read() public. This resolves pull #15. 2014-06-02 13:13:50 -07:00
Tony DiCola
ffac2f15b7 Update example to show temp in Fahrenheit and add computeHeatIndex function to resolve issue #9. 2014-06-02 12:54:54 -07:00
Lars Kirkeskov Sørup
ad73fab623 Support for non 16mhz devices
Added constructor parameter to allow for different timing needs. It has
the a default value of 6 which is the original value, so it should be
backwards compatible
2012-12-29 19:14:51 +01:00
Colin Miller
fca71323bd Prevent dht.h being imported multiple times
Added a basic #ifndef DHT_H to the dht.h file so that if you have a
larger program and want to access the sensor from a different file, you
don't import it twice.
2012-07-26 21:39:47 -07:00
Paint Your Dragon
53e6481231 Default argument for compatibility with old sketches 2012-02-23 11:43:30 -08:00
leprasmurf
8f46f27b66 Modified readTemperature() prototype. Added prototype for new function. 2012-02-22 22:20:19 -05:00
Paint Your Dragon
cffd745009 Arduino 1.0 compliant 2011-12-02 19:50:02 -08:00
Ladyada
57ac62dab7 fully tested working DHT11/21/22 with built in '2 second' timer 2011-06-22 13:11:06 -04:00
Ladyada
7ecd3141a8 touch commit 2011-06-20 19:47:50 -04:00