mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.4.16 DHTNEW
This commit is contained in:
parent
003a7a9483
commit
b964bc2a6e
@ -25,4 +25,4 @@ compile:
|
||||
- esp8266
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
||||
|
||||
|
@ -6,124 +6,128 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.4.15] 2022-10-13
|
||||
## [0.4.16] - 2022-10-17
|
||||
- Fix #84 correct the reading of type 70 for Sonoff Si7021.
|
||||
- fix keywords.txt
|
||||
|
||||
## [0.4.15] - 2022-10-13
|
||||
- Fix #81, recognize DHT22 as type 70. Add minimal wakeup delay.
|
||||
|
||||
## [0.4.14] 2022-10-13
|
||||
## [0.4.14] - 2022-10-13
|
||||
- Fix #79, experimental support for Si7021.
|
||||
- Add RP2040 pico in build-CI
|
||||
- Add CHANGELOG.md
|
||||
|
||||
## [0.4.13] 2022-07-05
|
||||
## [0.4.13] - 2022-07-05
|
||||
- Fix #76, disable interrupts for ESP32.
|
||||
|
||||
## [0.4.12] 2022-01-31
|
||||
## [0.4.12] - 2022-01-31
|
||||
- Fix #72, delayMicroseconds() for wakeUp
|
||||
|
||||
## [0.4.11] 2021-12-16
|
||||
## [0.4.11] - 2021-12-16
|
||||
- update library.json, license, minor edits (clean up),
|
||||
- add constants to unit tests
|
||||
|
||||
## [0.4.10] 2021-11-18
|
||||
## [0.4.10] - 2021-11-18
|
||||
- update build-CI - compilation test on M4 and ESP32 of examples
|
||||
- update readme.md, badges, typos, reorganizing
|
||||
- added note: MKR1010 Wifi support - setDisableIRQ(false)
|
||||
- minor edits in examples
|
||||
- changed TIMEOUT_C to 90us (after endurance test on MKR1010 Wifi)
|
||||
|
||||
## [0.4.9] - 2021-06-13
|
||||
## [0.4.9] - 2021-06-13
|
||||
- add optional flag DHTLIB_VALUE_OUT_OF_RANGE
|
||||
|
||||
## [0.4.8] - 2021-05-27
|
||||
## [0.4.8] - 2021-05-27
|
||||
- fixes to improve Arduino-lint
|
||||
|
||||
## [0.4.7] - 2021-04-09
|
||||
## [0.4.7] - 2021-04-09
|
||||
- fix #60 negative temperatures below -25.5°C + readme.md
|
||||
|
||||
## [0.4.6] - 2021-04-09
|
||||
## [0.4.6] - 2021-04-09
|
||||
- fix #57 negative temperatures DHT22
|
||||
- Do not use 0.4.5 and 0.4.4 as these are incorrect for negative temperature.
|
||||
|
||||
## [0.4.5] - 2021-02-14
|
||||
## [0.4.5] - 2021-02-14
|
||||
- fix -0°C encoding of DHT22 ( bit pattern 0x8000 )
|
||||
|
||||
## [0.4.4] - 2021-02-01
|
||||
## [0.4.4] - 2021-02-01
|
||||
- fix negative temperatures DHT22 (again)
|
||||
|
||||
## [0.4.3] - 2021-01-13
|
||||
## [0.4.3] - 2021-01-13
|
||||
- add reset(), add lastRead()
|
||||
|
||||
## [0.4.2] - 2020-12-15
|
||||
## [0.4.2] - 2020-12-15
|
||||
- fix negative temperatures
|
||||
|
||||
## [0.4.1] - 2020-11-11
|
||||
## [0.4.1] - 2020-11-11
|
||||
- getType() attempts to detect sensor type
|
||||
- add Arduino -CI + readme
|
||||
|
||||
## [0.4.0] - 2020-11-10
|
||||
## [0.4.0] - 2020-11-10
|
||||
- added DHTLIB_WAITING_FOR_READ as return value of read (minor break of interface)
|
||||
|
||||
----
|
||||
|
||||
## [0.3.4] - 2020-09-23
|
||||
## [0.3.4] - 2020-09-23
|
||||
- Added **waitFor(state, timeout)** to follow timing from datasheet.
|
||||
- Restored disableIRQ flag as problems occurred on AVR.
|
||||
- Restored disableIRQ flag as problems occurred on AVR.
|
||||
The default of this flag on AVR is false so interrupts are allowed.
|
||||
- This need some investigation
|
||||
- Fix wake up timing for DHT11 as it does not behave according datasheet.
|
||||
- fix wakeupDelay bug in setType();
|
||||
|
||||
## [0.3.3] - 2020-08-18
|
||||
## [0.3.3] - 2020-08-18
|
||||
- fix #29, create explicit delay between pulling line HIGH and
|
||||
waiting for LOW in handshake to trigger the sensor.
|
||||
- On fast ESP32 this fails because the capacity / voltage of the long wire
|
||||
- cannot rise fast enough to be read back as HIGH.
|
||||
|
||||
## [0.3.2] - 2020-07-17
|
||||
## [0.3.2] - 2020-07-17
|
||||
- fix #23 added get/setSuppressError(); overridable DHTLIB_INVALID_VALUE
|
||||
|
||||
## [0.3.1] - 2020-07-08
|
||||
## [0.3.1] - 2020-07-08
|
||||
- added powerUp() powerDown();
|
||||
|
||||
## [0.3.0] - 2020-06-12
|
||||
## [0.3.0] - 2020-06-12
|
||||
- added getReadDelay & setReadDelay to tune reading interval
|
||||
- removed get/setDisableIRQ; adjusted wakeup timing; refactor
|
||||
|
||||
----
|
||||
|
||||
## [0.2.2] - 2020-06-08
|
||||
## [0.2.2] - 2020-06-08
|
||||
- added ERROR_SENSOR_NOT_READY and differentiate timeout errors
|
||||
|
||||
## [0.2.1] - 2020-05-27
|
||||
## [0.2.1] - 2020-05-27
|
||||
- Fix #11 - Adjust bit timing threshold
|
||||
|
||||
## [0.2.0] - 2020-05-02
|
||||
## [0.2.0] - 2020-05-02
|
||||
- made temperature and humidity private (Kudo's to Mr-HaleYa),
|
||||
|
||||
----
|
||||
|
||||
## [0.1.7] - 2020-05-01
|
||||
## [0.1.7] - 2020-05-01
|
||||
- prevent premature read; add waitForReading flag (Kudo's to Mr-HaleYa),
|
||||
|
||||
## [0.1.6] - 2020-04-09
|
||||
## [0.1.6] - 2020-04-09
|
||||
- #pragma once, readme.md, own repo
|
||||
|
||||
## [0.1.5] - 2019-01-20
|
||||
## [0.1.5] - 2019-01-20
|
||||
- fix negative temperature DHT22 - issue #120
|
||||
|
||||
## [0.1.4] - 2018-04-03
|
||||
## [0.1.4] - 2018-04-03
|
||||
- add get-/setDisableIRQ(bool b)
|
||||
|
||||
## [0.1.3] - 2018-01-08
|
||||
## [0.1.3] - 2018-01-08
|
||||
- removed begin() + moved detection to read() function
|
||||
|
||||
## [0.1.2] - 2018-01-08
|
||||
## [0.1.2] - 2018-01-08
|
||||
- improved begin() + refactor()
|
||||
|
||||
## [0.1.1] - 2017-07-29
|
||||
## [0.1.1] - 2017-07-29
|
||||
- add begin() to determine type once and for all instead of every call + refactor
|
||||
|
||||
## [0.1.0] - 2017-07-24
|
||||
## [0.1.0] - 2017-07-24
|
||||
- initial version based upon DHTStable
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: dhtnew.cpp
|
||||
// AUTHOR: Rob.Tillaart@gmail.com
|
||||
// VERSION: 0.4.15
|
||||
// VERSION: 0.4.16
|
||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||
// URL: https://github.com/RobTillaart/DHTNEW
|
||||
//
|
||||
@ -180,7 +180,12 @@ int DHTNEW::_read()
|
||||
return rv; // propagate error value
|
||||
}
|
||||
|
||||
if (_type == 22) // DHT22, DHT33, DHT44, compatible
|
||||
if (_type == 11) // DHT11, DH12, compatible
|
||||
{
|
||||
_humidity = _bits[0] + _bits[1] * 0.1;
|
||||
_temperature = _bits[2] + _bits[3] * 0.1;
|
||||
}
|
||||
else // DHT22, DHT33, DHT44, compatible + Si7021
|
||||
{
|
||||
_humidity = (_bits[0] * 256 + _bits[1]) * 0.1;
|
||||
int16_t t = ((_bits[2] & 0x7F) * 256 + _bits[3]);
|
||||
@ -197,11 +202,7 @@ int DHTNEW::_read()
|
||||
}
|
||||
}
|
||||
}
|
||||
else // if (_type == 11) // DHT11, DH12, compatible
|
||||
{
|
||||
_humidity = _bits[0] + _bits[1] * 0.1;
|
||||
_temperature = _bits[2] + _bits[3] * 0.1;
|
||||
}
|
||||
|
||||
|
||||
// HEXDUMP DEBUG
|
||||
/*
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: dhtnew.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.4.15
|
||||
// VERSION: 0.4.16
|
||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||
// URL: https://github.com/RobTillaart/DHTNEW
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
#define DHTNEW_LIB_VERSION (F("0.4.15"))
|
||||
#define DHTNEW_LIB_VERSION (F("0.4.16"))
|
||||
|
||||
|
||||
#define DHTLIB_OK 0
|
||||
@ -59,7 +59,7 @@ public:
|
||||
|
||||
DHTNEW(uint8_t pin);
|
||||
|
||||
// resets all internals to construction time
|
||||
// resets all internals to construction time
|
||||
// might help to reset a sensor behaving badly..
|
||||
void reset();
|
||||
|
||||
|
@ -8,7 +8,7 @@ DHTNEW KEYWORD1
|
||||
# Methods and Functions (KEYWORD2)
|
||||
reset KEYWORD2
|
||||
getType KEYWORD2
|
||||
setType() KEYWORD2
|
||||
setType KEYWORD2
|
||||
read KEYWORD2
|
||||
lastRead KEYWORD2
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "DHTNEW",
|
||||
"keywords": "DHT11, DHT22, DHT33, DHT44, AM2301, AM2302, AM2303, autodetect, offset, interrupt, powerDown",
|
||||
"description": "Arduino library for DHT temperature and humidity sensor, with automatic sensortype recognition.",
|
||||
"description": "Arduino library for DHT temperature and humidity sensor, with automatic sensortype recognition.\n(Sonoff Si7021)",
|
||||
"authors":
|
||||
{
|
||||
"name": "Rob Tillaart",
|
||||
@ -13,7 +13,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/DHTNEW.git"
|
||||
},
|
||||
"version": "0.4.15",
|
||||
"version": "0.4.16",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=DHTNEW
|
||||
version=0.4.15
|
||||
version=0.4.16
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for DHT temperature and humidity sensor, with automatic sensortype recognition.
|
||||
paragraph=Types supported: DHT11, DHT22, DHT33, DHT44, AM2301, AM2302, AM2303, autodetect, offset, interrupt, powerDown
|
||||
paragraph=Types supported: DHT11, DHT22, DHT33, DHT44, AM2301, AM2302, AM2303, Sonoff Si7021, autodetect, offset, interrupt, powerDown
|
||||
category=Sensors
|
||||
url=https://github.com/RobTillaart/DHTNEW
|
||||
architectures=*
|
||||
|
@ -24,7 +24,7 @@ Note there are differences e.g. DHT11 has no negative temperature, no decimals,
|
||||
Since 0.4.14 there is **experimental** support for the Sonoff Si7021 .
|
||||
No hardware yet to test this myself, but it is confirmed to work.(see #79)
|
||||
Seems the Sonoff Si7021 sensor is very sensitive in the wakeup timing.
|
||||
This behavior needs to be investigated in the future.
|
||||
This behaviour needs to be investigated in the future.
|
||||
|
||||
|
||||
## DHT PIN layout from left to right
|
||||
@ -82,7 +82,8 @@ Since 0.4.14 type 70 is added for **experimental** Sonoff Si7021 support.
|
||||
- **uint32_t lastRead()** returns milliseconds since last **read()**
|
||||
- **float getHumidity()** returns last read value (float) or -999 in case of error.
|
||||
Note this error value can be suppressed by **setSuppressError(bool)**.
|
||||
- **float getTemperature()** returns last read value (float) or -999 in case of error. Note this error value can be suppressed by **setSuppressError(bool)**.
|
||||
- **float getTemperature()** returns last read value (float) or -999 in case of error.
|
||||
Note this error value can be suppressed by **setSuppressError(bool)**.
|
||||
|
||||
|
||||
### Offset
|
||||
@ -238,6 +239,10 @@ Fix #72, delayMicroseconds() for wakeUp
|
||||
Fix #76, disable interrupts for ESP32.
|
||||
30. (0.4.14)
|
||||
added experimental support for Si7021.
|
||||
31. (0.4.15)
|
||||
Fix #81, recognize DHT22 as type 70. Add minimal wakeup delay.
|
||||
32. (0.4.16)
|
||||
Fix #84 correct the reading of type 70 for Sonoff Si7021.
|
||||
|
||||
|
||||
## Future
|
||||
|
Loading…
Reference in New Issue
Block a user