fix issue #31 + fix issue #33

This commit is contained in:
RobTillaart 2017-07-27 01:18:02 +02:00
parent a14700e767
commit 994981700d
5 changed files with 44 additions and 10 deletions

View File

@ -1,11 +1,13 @@
//
// FILE: dht.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.22
// VERSION: 0.1.24
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: http://arduino.cc/playground/Main/DHTLib
//
// HISTORY:
// 0.1.24 2017-07-27 double -> float
// 0.1.23 2017-07-24 FIX https://github.com/RobTillaart/Arduino/issues/31
// 0.1.22 undo delayMicroseconds() for wakeups larger than 8
// 0.1.21 replace delay with delayMicroseconds() + small fix
// 0.1.20 Reduce footprint by using uint8_t as error codes. (thanks to chaveiro)
@ -126,7 +128,7 @@ int8_t dht::_readSensor(uint8_t pin, uint8_t wakeupDelay, uint8_t leadingZeroBit
digitalWrite(pin, LOW); // T-be
if (wakeupDelay > 8) delay(wakeupDelay);
else delayMicroseconds(wakeupDelay * 1000UL);
digitalWrite(pin, HIGH); // T-go
// digitalWrite(pin, HIGH); // T-go
pinMode(pin, INPUT);
uint16_t loopCount = DHTLIB_TIMEOUT * 2; // 200uSec max
@ -191,8 +193,8 @@ int8_t dht::_readSensor(uint8_t pin, uint8_t wakeupDelay, uint8_t leadingZeroBit
}
}
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
// pinMode(pin, OUTPUT);
// digitalWrite(pin, HIGH);
return DHTLIB_OK;
}

View File

@ -1,7 +1,7 @@
//
// FILE: dht.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.22
// VERSION: 0.1.24
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: http://arduino.cc/playground/Main/DHTLib
//
@ -19,7 +19,7 @@
#include <Arduino.h>
#endif
#define DHT_LIB_VERSION "0.1.22"
#define DHT_LIB_VERSION "0.1.24"
#define DHTLIB_OK 0
#define DHTLIB_ERROR_CHECKSUM -1
@ -64,8 +64,8 @@ public:
inline int8_t read33(uint8_t pin) { return read(pin); };
inline int8_t read44(uint8_t pin) { return read(pin); };
double humidity;
double temperature;
float humidity;
float temperature;
private:
uint8_t bits[5]; // buffer to receive data

View File

@ -0,0 +1,32 @@
#######################################
# Syntax Coloring Map For DHT
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
DHT KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
read KEYWORD2
read11 KEYWORD2
read21 KEYWORD2
read22 KEYWORD2
read33 KEYWORD2
read44 KEYWORD2
humidity KEYWORD2
temperature KEYWORD2
#######################################
# Instances (KEYWORD2)
#######################################
#######################################
# Constants (LITERAL1)
#######################################

View File

@ -1,9 +1,9 @@
name=DHTlib
version=0.1.22
version=0.1.24
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Optimized Library for DHT Temperature & Humidity Sensor on AVR only.
paragraph=
category=Sensors
url=https://github.com/RobTillaart/Arduino/Libraries/
architectures=avr
architectures=atmelavr