0.2.1 DHT20

This commit is contained in:
rob tillaart 2022-12-21 21:48:21 +01:00
parent b455c6cf20
commit 77ab81656b
6 changed files with 23 additions and 13 deletions

View File

@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.1] - 2022-12-21
- first part of the **readStatus()** not part of the protocol
- different interpretation of datasheet page 10 section 7.4
- the state is sent after a read command as first byte
- see https://github.com/RobTillaart/DHT20/issues/8 + page 11 datasheet
- add **getAddress()** convenience function.
## [0.2.0] - 2022-10-30
- add changelog.md
- add rp2040 to build-CI

View File

@ -1,10 +1,8 @@
//
// FILE: DHT20.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.2.0
// VERSION: 0.2.1
// PURPOSE: Arduino library for DHT20 I2C temperature and humidity sensor.
//
// HISTORY: see changelog.md
#include "DHT20.h"
@ -62,6 +60,12 @@ bool DHT20::isConnected()
}
uint8_t DHT20::getAddress()
{
return DHT20_ADDRESS;
}
// See datasheet 7.4 Sensor Reading Process, point 1
// use with care.
uint8_t DHT20::resetSensor()
@ -225,10 +229,6 @@ float DHT20::getTempOffset()
//
uint8_t DHT20::readStatus()
{
_wire->beginTransmission(DHT20_ADDRESS);
_wire->write(0x71);
_wire->endTransmission();
delay(1); // needed to stabilize timing
_wire->requestFrom(DHT20_ADDRESS, (uint8_t)1);
delay(1); // needed to stabilize timing
return (uint8_t) _wire->read();

View File

@ -3,7 +3,7 @@
// FILE: DHT20.h
// AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for DHT20 I2C temperature and humidity sensor.
// VERSION: 0.2.0
// VERSION: 0.2.1
// HISTORY: See DHT20.cpp
// URL: https://github.com/RobTillaart/DHT20
//
@ -21,7 +21,7 @@
#include "Arduino.h"
#include "Wire.h"
#define DHT20_LIB_VERSION (F("0.2.0"))
#define DHT20_LIB_VERSION (F("0.2.1"))
#define DHT20_OK 0
#define DHT20_ERROR_CHECKSUM -10
@ -45,6 +45,7 @@ public:
#endif
bool begin();
bool isConnected();
uint8_t getAddress();
// ASYNCHRONUOUS CALL

View File

@ -82,7 +82,7 @@ Please let me know if other platforms work (or not).
- **bool begin(uint8_t dataPin, uint8_t clockPin)** begin for ESP32 et al, to set I2C bus pins.
- **bool begin()** initializer for non ESP32. Returns true if connected.
- **bool isConnected()** returns true if the address of the DHT20 can be seen on the I2C bus.
- **uint8_t getAddress()** returns the (fixed) address - convenience.
### Core
@ -186,6 +186,7 @@ See examples
#### must
- improve documentation.
- investigate the bug from #8 further
(is done in 0.2.1 see issue #8)
#### should
@ -197,7 +198,7 @@ See examples
- investigate optimizing timing in readStatus()
- delay(1) ==> microSeconds(???).
- connected flag?
- add **uint8_t getAddress()** to return the address (convenience).
#### won't

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/DHT20.git"
},
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=DHT20
version=0.2.0
version=0.2.1
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for I2C DHT20 temperature and humidity sensor.