Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small corrections #8

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ get_Humidity KEYWORD2
AM2302_READ_OK LITERAL1
AM2302_ERROR_CHECKSUM LITERAL1
AM2302_ERROR_TIMEOUT LITERAL1
AM2302_ERROR_READ_FREQ LITERAL1
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "AM2302-Sensor",
"version": "1.3.0",
"version": "1.3.1",
"repository":
{
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=AM2302-Sensor
version=1.3.0
version=1.3.1
author=Frank Häfele <[email protected]>
maintainer=Frank Häfele <[email protected]>
sentence=This library read temperature and humidity from the AM2302 (aka DHT22) senor.
Expand Down
2 changes: 1 addition & 1 deletion src/AM2302-Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int8_t AM2302::AM2302_Sensor::read_sensor_data(uint8_t *buffer, uint8_t size) {
// count wait for state time
while ( !digitalRead(_pin) ) {
++wait_counter;
delayMicroseconds(1.0);
delayMicroseconds(1U);
if (wait_counter >= READ_TIMEOUT) {
return AM2302_ERROR_TIMEOUT;
}
Expand Down
2 changes: 2 additions & 0 deletions src/AM2302-Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace AM2302 {

// define timeout in 100 µs
constexpr uint8_t READ_TIMEOUT {100U};

// define maximum sensor read frequency in milliseconds (2 s)
constexpr uint16_t READ_FREQUENCY {2000U};

class AM2302_Sensor {
Expand Down