0.1.34 DHTlib

This commit is contained in:
rob tillaart 2021-11-13 19:57:17 +01:00
parent 295c1d6728
commit 8a64b66732
7 changed files with 46 additions and 18 deletions

View File

@ -2,4 +2,10 @@ compile:
# Choosing to run compilation tests on 2 different Arduino platforms # Choosing to run compilation tests on 2 different Arduino platforms
platforms: platforms:
- uno - uno
# - due
# - zero
- leonardo - leonardo
# - m4
# - esp32
# - esp8266
- mega2560

View File

@ -4,10 +4,14 @@ name: Arduino CI
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
arduino_ci: runTest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: Arduino-CI/action@master - uses: ruby/setup-ruby@v1
# Arduino-CI/action@v0.1.1 with:
ruby-version: 2.6
- run: |
gem install arduino_ci
arduino_ci.rb

View File

@ -1,12 +1,13 @@
// //
// FILE: dht.cpp // FILE: dht.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.33 // VERSION: 0.1.34
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino, AVR optimized // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino, AVR optimized
// URL: https://github.com/RobTillaart/DHTlib // URL: https://github.com/RobTillaart/DHTlib
// http://arduino.cc/playground/Main/DHTLib // http://arduino.cc/playground/Main/DHTLib
// //
// HISTORY: // 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.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.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) // 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; bits[2] &= 0x83;
// CONVERT AND STORE // CONVERT AND STORE
humidity = (bits[0] * 256 + bits[1]) * 0.1; humidity = (bits[0] * 256 + bits[1]) * 0.1;
int16_t t = (bits[2] * 256 + bits[3]); int16_t t = ((bits[2] & 0x7F) * 256 + bits[3]);
temperature = t * 0.1; if (t == 0)
{
temperature = 0.0; // prevent -0.0;
}
else
{
temperature = t * 0.1;
if((bits[2] & 0x80) == 0x80 )
{
temperature = -temperature;
}
}
// HEXDUMP DEBUG // HEXDUMP DEBUG
/* /*

View File

@ -1,7 +1,7 @@
// //
// FILE: dht.h // FILE: dht.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.33 // VERSION: 0.1.34
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino. AVR optimized // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino. AVR optimized
// URL: https://github.com/RobTillaart/DHTlib // URL: https://github.com/RobTillaart/DHTlib
// http://arduino.cc/playground/Main/DHTLib // http://arduino.cc/playground/Main/DHTLib
@ -21,7 +21,7 @@
#endif #endif
#define DHT_LIB_VERSION (F("0.1.33")) #define DHT_LIB_VERSION (F("0.1.34"))
#define DHTLIB_OK 0 #define DHTLIB_OK 0
#define DHTLIB_ERROR_CHECKSUM -1 #define DHTLIB_ERROR_CHECKSUM -1

View File

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

View File

@ -1,5 +1,5 @@
name=DHTlib name=DHTlib
version=0.1.33 version=0.1.34
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=AVR Optimized Library for DHT Temperature & Humidity Sensor on AVR only. sentence=AVR Optimized Library for DHT Temperature & Humidity Sensor on AVR only.

View File

@ -1,12 +1,16 @@
[![Arduino CI](https://github.com/RobTillaart/DHTlib/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) [![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) [![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) [![GitHub release](https://img.shields.io/github/release/RobTillaart/DHTlib.svg?maxAge=3600)](https://github.com/RobTillaart/DHTlib/releases)
# DHTlib # DHTlib
Arduino library for DHT temperature and humidity sensor. AVR optimized Arduino library for DHT temperature and humidity sensor. AVR optimized
## Description ## Description
The DHT11, 21, 22, 33 and 44 are relative inexpensive sensors for measuring temperature and humidity. 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 For latest version for the DHT, check https://github.com/RobTillaart/DHTNEW
## DHT PIN layout from left to right ## DHT PIN layout from left to right
| FRONT | | DESCRIPTION | | Front | | Description |
|:----|:----:|:----| |:------|:----:|:--------------|
| pin 1 | | VCC | | pin 1 | | VCC |
| pin 2 | | DATA | | pin 2 | | DATA |
| pin 3 | | Not Connected | | pin 3 | | Not Connected |
| pin 4 | | GND | | pin 4 | | GND |
|
## Operational ## Operational