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

fix #104, support KY015 (again) #105

Merged
merged 3 commits into from
Dec 29, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions dhtnew.cpp
Original file line number Diff line number Diff line change
@@ -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
//
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions dhtnew.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/dhtnew_dht11/dhtnew_dht11.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion examples/dhtnew_dht22/dhtnew_dht22.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
28 changes: 28 additions & 0 deletions examples/dhtnew_endless_debug/.arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -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

70 changes: 70 additions & 0 deletions examples/dhtnew_endless_debug/dhtnew_endless_debug.ino
Original file line number Diff line number Diff line change
@@ -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.h>

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 --
2 changes: 1 addition & 1 deletion examples/dhtnew_simple/dhtnew_simple.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
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=DHTNEW
version=0.5.1
version=0.5.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for DHT temperature and humidity sensor, with automatic sensortype recognition.
Expand Down
Loading