diff --git a/libraries/DHTlib/.arduino-ci.yml b/libraries/DHTlib/.arduino-ci.yml index da06216b..0e449bc8 100644 --- a/libraries/DHTlib/.arduino-ci.yml +++ b/libraries/DHTlib/.arduino-ci.yml @@ -2,4 +2,10 @@ compile: # Choosing to run compilation tests on 2 different Arduino platforms platforms: - uno + # - due + # - zero - leonardo + # - m4 + # - esp32 + # - esp8266 + - mega2560 \ No newline at end of file diff --git a/libraries/DHTlib/.github/workflows/arduino_test_runner.yml b/libraries/DHTlib/.github/workflows/arduino_test_runner.yml index 476456bb..096b975b 100644 --- a/libraries/DHTlib/.github/workflows/arduino_test_runner.yml +++ b/libraries/DHTlib/.github/workflows/arduino_test_runner.yml @@ -4,10 +4,14 @@ name: Arduino CI on: [push, pull_request] jobs: - arduino_ci: + runTest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: Arduino-CI/action@master - # Arduino-CI/action@v0.1.1 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - run: | + gem install arduino_ci + arduino_ci.rb diff --git a/libraries/DHTlib/dht.cpp b/libraries/DHTlib/dht.cpp index 4f39f9f9..bf5a678c 100644 --- a/libraries/DHTlib/dht.cpp +++ b/libraries/DHTlib/dht.cpp @@ -1,12 +1,13 @@ // // FILE: dht.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.1.33 +// VERSION: 0.1.34 // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino, AVR optimized // URL: https://github.com/RobTillaart/DHTlib // http://arduino.cc/playground/Main/DHTLib // // HISTORY: +// 0.1.34 2021-11-13 fix negative temperature DHT22 again (code from DHTNew) // 0.1.33 2021-02-16 fix #6 T-GO signal in handshake. (needed for long wires) // 0.1.32 2021-02-01 fix negative temperature DHT22 again (code from DHTNew) // 0.1.31 2020-12-15 fix negative temperature DHT22 (code from DHTNew) @@ -115,9 +116,20 @@ int8_t dht::read(uint8_t pin) bits[2] &= 0x83; // CONVERT AND STORE - humidity = (bits[0] * 256 + bits[1]) * 0.1; - int16_t t = (bits[2] * 256 + bits[3]); - temperature = t * 0.1; + humidity = (bits[0] * 256 + bits[1]) * 0.1; + int16_t t = ((bits[2] & 0x7F) * 256 + bits[3]); + if (t == 0) + { + temperature = 0.0; // prevent -0.0; + } + else + { + temperature = t * 0.1; + if((bits[2] & 0x80) == 0x80 ) + { + temperature = -temperature; + } + } // HEXDUMP DEBUG /* diff --git a/libraries/DHTlib/dht.h b/libraries/DHTlib/dht.h index 0f182538..5657c8cc 100644 --- a/libraries/DHTlib/dht.h +++ b/libraries/DHTlib/dht.h @@ -1,7 +1,7 @@ // // FILE: dht.h // AUTHOR: Rob Tillaart -// VERSION: 0.1.33 +// VERSION: 0.1.34 // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino. AVR optimized // URL: https://github.com/RobTillaart/DHTlib // http://arduino.cc/playground/Main/DHTLib @@ -21,7 +21,7 @@ #endif -#define DHT_LIB_VERSION (F("0.1.33")) +#define DHT_LIB_VERSION (F("0.1.34")) #define DHTLIB_OK 0 #define DHTLIB_ERROR_CHECKSUM -1 diff --git a/libraries/DHTlib/library.json b/libraries/DHTlib/library.json index 730bd272..cf53380a 100644 --- a/libraries/DHTlib/library.json +++ b/libraries/DHTlib/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/DHTlib.git" }, - "version": "0.1.33", + "version": "0.1.34", "license": "MIT", "frameworks": "arduino", "platforms": "*" diff --git a/libraries/DHTlib/library.properties b/libraries/DHTlib/library.properties index 8992395e..4aa267c5 100644 --- a/libraries/DHTlib/library.properties +++ b/libraries/DHTlib/library.properties @@ -1,5 +1,5 @@ name=DHTlib -version=0.1.33 +version=0.1.34 author=Rob Tillaart maintainer=Rob Tillaart sentence=AVR Optimized Library for DHT Temperature & Humidity Sensor on AVR only. diff --git a/libraries/DHTlib/readme.md b/libraries/DHTlib/readme.md index 29ea48ce..0f3d4127 100644 --- a/libraries/DHTlib/readme.md +++ b/libraries/DHTlib/readme.md @@ -1,12 +1,16 @@ [![Arduino CI](https://github.com/RobTillaart/DHTlib/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) +[![Arduino-lint](https://github.com/RobTillaart/DHTlib/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DHTlib/actions/workflows/arduino-lint.yml) +[![JSON check](https://github.com/RobTillaart/DHTlib/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DHTlib/actions/workflows/jsoncheck.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DHTlib/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/RobTillaart/DHTlib.svg?maxAge=3600)](https://github.com/RobTillaart/DHTlib/releases) + # DHTlib Arduino library for DHT temperature and humidity sensor. AVR optimized + ## Description The DHT11, 21, 22, 33 and 44 are relative inexpensive sensors for measuring temperature and humidity. @@ -31,15 +35,17 @@ More information - http://playground.arduino.cc/Main/DHTLib - For latest version for the DHT, check https://github.com/RobTillaart/DHTNEW + ## DHT PIN layout from left to right -| FRONT | | DESCRIPTION | -|:----|:----:|:----| -| pin 1 | | VCC | -| pin 2 | | DATA | -| pin 3 | | Not Connected | -| pin 4 | | GND | - | +| Front | | Description | +|:------|:----:|:--------------| +| pin 1 | | VCC | +| pin 2 | | DATA | +| pin 3 | | Not Connected | +| pin 4 | | GND | + + ## Operational