diff --git a/libraries/DHTNEW/CHANGELOG.md b/libraries/DHTNEW/CHANGELOG.md index 0a748cb5..05ad7129 100644 --- a/libraries/DHTNEW/CHANGELOG.md +++ b/libraries/DHTNEW/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.5.2] - 2024-11-26 +- fix #104, add support for KY015 (again) +- minor edits examples +- add **DHT_endless_debug.ino** develop example + + ## [0.5.1] - 2024-11-24 - fix #102, add support for KY015 - add three examples, dhtnew_dht11.ino, dhtnew_dht22.ino, dhtnew_simple.ino diff --git a/libraries/DHTNEW/dhtnew.cpp b/libraries/DHTNEW/dhtnew.cpp index 9896e469..a5879ba6 100644 --- a/libraries/DHTNEW/dhtnew.cpp +++ b/libraries/DHTNEW/dhtnew.cpp @@ -1,7 +1,7 @@ // // FILE: dhtnew.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.5.1 +// VERSION: 0.5.2 // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino // URL: https://github.com/RobTillaart/DHTNEW // @@ -141,7 +141,7 @@ int DHTNEW::read() int rv = _read(); if (rv == DHTLIB_OK) { - // see issue #102 + // see issue #102, #104 // test high humidity bits to check for KY015/ DHT11 encoding // in DHT22 encoding humidity cannot be over 100.0 % == 0x03E8 // so the high bits cannot be over 0x03 @@ -151,9 +151,12 @@ int DHTNEW::read() { return rv; } - // fall through to test KY015 as DHT11 + // KY015 as DHT11 + _type = 11; + _wakeupDelay = DHTLIB_DHT11_WAKEUP; + rv = _read(); // read again with correct conversion. + return rv; } - _type = 11; _wakeupDelay = DHTLIB_DHT11_WAKEUP; rv = _read(); diff --git a/libraries/DHTNEW/dhtnew.h b/libraries/DHTNEW/dhtnew.h index 1a9c5834..e7095bc6 100644 --- a/libraries/DHTNEW/dhtnew.h +++ b/libraries/DHTNEW/dhtnew.h @@ -2,7 +2,7 @@ // // FILE: dhtnew.h // AUTHOR: Rob Tillaart -// VERSION: 0.5.1 +// VERSION: 0.5.2 // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino // URL: https://github.com/RobTillaart/DHTNEW // @@ -18,7 +18,7 @@ #include "Arduino.h" -#define DHTNEW_LIB_VERSION (F("0.5.1")) +#define DHTNEW_LIB_VERSION (F("0.5.2")) #define DHTLIB_OK 0 diff --git a/libraries/DHTNEW/examples/dhtnew_dht11/dhtnew_dht11.ino b/libraries/DHTNEW/examples/dhtnew_dht11/dhtnew_dht11.ino index 00fafd78..fc86aa82 100644 --- a/libraries/DHTNEW/examples/dhtnew_dht11/dhtnew_dht11.ino +++ b/libraries/DHTNEW/examples/dhtnew_dht11/dhtnew_dht11.ino @@ -23,7 +23,7 @@ void setup() while (!Serial); // MKR1010 needs this Serial.begin(115200); - Serial.println("dhtnew_test.ino"); + Serial.println("dhtnew_dht11.ino"); Serial.print("LIBRARY VERSION: "); Serial.println(DHTNEW_LIB_VERSION); Serial.println(); diff --git a/libraries/DHTNEW/examples/dhtnew_dht22/dhtnew_dht22.ino b/libraries/DHTNEW/examples/dhtnew_dht22/dhtnew_dht22.ino index 13de4322..dcbaefec 100644 --- a/libraries/DHTNEW/examples/dhtnew_dht22/dhtnew_dht22.ino +++ b/libraries/DHTNEW/examples/dhtnew_dht22/dhtnew_dht22.ino @@ -23,7 +23,7 @@ void setup() while (!Serial); // MKR1010 needs this Serial.begin(115200); - Serial.println("dhtnew_test.ino"); + Serial.println("dhtnew_dht22.ino"); Serial.print("LIBRARY VERSION: "); Serial.println(DHTNEW_LIB_VERSION); Serial.println(); diff --git a/libraries/DHTNEW/examples/dhtnew_endless_debug/.arduino-ci.yml b/libraries/DHTNEW/examples/dhtnew_endless_debug/.arduino-ci.yml new file mode 100644 index 00000000..783ab315 --- /dev/null +++ b/libraries/DHTNEW/examples/dhtnew_endless_debug/.arduino-ci.yml @@ -0,0 +1,28 @@ +platforms: + rpipico: + board: rp2040:rp2040:rpipico + package: rp2040:rp2040 + gcc: + features: + defines: + - ARDUINO_ARCH_RP2040 + warnings: + flags: + +packages: + rp2040:rp2040: + url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + +compile: + # Choosing to run compilation tests on 2 different Arduino platforms + platforms: + # - uno + # - due + # - zero + # - leonardo + # - m4 + # - esp32 + # - esp8266 + # - mega2560 + # - rpipico + diff --git a/libraries/DHTNEW/examples/dhtnew_endless_debug/dhtnew_endless_debug.ino b/libraries/DHTNEW/examples/dhtnew_endless_debug/dhtnew_endless_debug.ino new file mode 100644 index 00000000..79e8d02c --- /dev/null +++ b/libraries/DHTNEW/examples/dhtnew_endless_debug/dhtnew_endless_debug.ino @@ -0,0 +1,70 @@ +// +// FILE: DHT_endless_debug.ino +// AUTHOR: Rob Tillaart +// PURPOSE: demo +// DATE: 2020-06-04 +// (c) : MIT + +// make _bits public + disable CRC check to run this program. + + +// DHT PIN layout from left to right +// ================================= +// FRONT : DESCRIPTION +// pin 1 : VCC +// pin 2 : DATA +// pin 3 : Not Connected +// pin 4 : GND + + +#include + +DHTNEW dht(5); // ESP 16 UNO 5 MKR1010 5 + +uint32_t count = 0; +uint32_t start, stop; + +uint32_t errors[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + +void setup() +{ + while (!Serial); // MKR1010 needs this + + Serial.begin(115200); + Serial.println("DHT_endless.ino"); + Serial.print("LIBRARY VERSION: "); + Serial.println(DHTNEW_LIB_VERSION); + Serial.println(); + + // MKR1010 needs this + // mySensor.setDisableIRQ(false); +} + + +void loop() +{ + dht.read(); + + float HumiVal = dht.getHumidity(); + float TempVal = dht.getTemperature(); + + Serial.print(count++); + Serial.print("\t"); + for (int i = 0; i < 5; i++) + { + if (dht._bits[i] < 0x10) Serial.print("0"); + Serial.print(dht._bits[i], HEX); + Serial.print(" "); + } + Serial.print("\t\t"); + Serial.print(TempVal); + Serial.print("\t"); + Serial.print(HumiVal); + Serial.println(); + + delay(2000); +} + + +// -- END OF FILE -- diff --git a/libraries/DHTNEW/examples/dhtnew_simple/dhtnew_simple.ino b/libraries/DHTNEW/examples/dhtnew_simple/dhtnew_simple.ino index 78a0f3dc..0097043f 100644 --- a/libraries/DHTNEW/examples/dhtnew_simple/dhtnew_simple.ino +++ b/libraries/DHTNEW/examples/dhtnew_simple/dhtnew_simple.ino @@ -23,7 +23,7 @@ void setup() while (!Serial); // MKR1010 needs this Serial.begin(115200); - Serial.println("dhtnew_test.ino"); + Serial.println("dhtnew_simple.ino"); Serial.print("LIBRARY VERSION: "); Serial.println(DHTNEW_LIB_VERSION); Serial.println(); diff --git a/libraries/DHTNEW/library.json b/libraries/DHTNEW/library.json index 431428cb..32ec7da8 100644 --- a/libraries/DHTNEW/library.json +++ b/libraries/DHTNEW/library.json @@ -13,7 +13,7 @@ "type": "git", "url": "https://github.com/RobTillaart/DHTNEW.git" }, - "version": "0.5.1", + "version": "0.5.2", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/libraries/DHTNEW/library.properties b/libraries/DHTNEW/library.properties index 35caaa37..3319067a 100644 --- a/libraries/DHTNEW/library.properties +++ b/libraries/DHTNEW/library.properties @@ -1,5 +1,5 @@ name=DHTNEW -version=0.5.1 +version=0.5.2 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for DHT temperature and humidity sensor, with automatic sensortype recognition.