Skip to content

Commit

Permalink
correct small typo and add small comment; update keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
hasenradball committed Dec 20, 2023
1 parent e4e97d6 commit ace8f1c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
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

0 comments on commit ace8f1c

Please sign in to comment.