Conversation
… high in software.
| // Note that count is now ignored as the DHT reading algorithm adjusts itself | ||
| // based on the speed of the processor. | ||
| DHT(uint8_t pin, uint8_t type, uint8_t count) { | ||
| DHT(pin, type); |
There was a problem hiding this comment.
I don't think that's quite accurate. What it does is a call to constructor DHT, but the instance constructed goes nowhere. Perhaps you wanted DHT(...): DHT(pin, type) { }; ?
There was a problem hiding this comment.
Thank you for your feedback.
I am not sure I understand your comment.
The 3 arg constructor DHT(pin, type, count) calls the 2 arg constructor with DHT(pin, type) in the header. The 2 arg constructor is the header definition for the 2 arg constructor in the DHT.cpp file. I removed the 3 arg constructor that used to be in the DHT.cpp file.
Does that make sense or am misunderstanding your comment?
There was a problem hiding this comment.
This is not the right C++ syntax to delegate constructors.
It does call the constructor indeed, but it just constructs another
instance instead, which is then immediately discarded. See for example
https://en.wikipedia.org/wiki/C%2B%2B11#Object_construction_improvement
On Fri, Mar 4, 2016, 07:23 Gregg Ubben notifications@github.com wrote:
In DHT.h
#54 (comment)
:@@ -37,11 +37,28 @@ written by Adafruit Industries
class DHT {
public:
- DHT(uint8_t pin, uint8_t type, uint8_t count=6);
- // Note that count is now ignored as the DHT reading algorithm adjusts itself
- // based on the speed of the processor.
- DHT(uint8_t pin, uint8_t type, uint8_t count) {
DHT(pin, type);Thank you for your feedback.
I am not sure I understand your comment.
The 3 arg constructor DHT(pin, type, count) calls the 2 arg constructor
with DHT(pin, type) in the header. The 2 arg constructor is the header
definition for the 2 arg constructor in the DHT.cpp file. I removed the 3
arg constructor that used to be in the DHT.cpp file.Does that make sense or am misunderstanding your comment?
—
Reply to this email directly or view it on GitHub
https://github.com/adafruit/DHT-sensor-library/pull/54/files#r54982620.
I added some convenience methods to the library while maintaining backwards compatibility.
There are now methods in DHT.h with Celsius and Fahrenheit in the method names which in turn call the existing methods with the boolean flag set accordingly. This makes the calling program easier to read and reduces confusion around what the flag means without having to look at the library each time.
I also removed count from the constructor in DHT.cpp. For backwards compatibility, I added a overload in DHT.h that accepts it, ignores it, and calls the constructor without it.