问题
See: https://github.com/adafruit/DHT-sensor-library/blob/master/DHT.h
In DHT.H the constructor initializes the parameter count=6
DHT(uint8_t pin, uint8_t type, uint8_t count=6);
In DHT.cpp I don't see the variable used anywhere. It only mentions:
// Note that count is now ignored as the DHT reading algorithm
// adjusts itself base on the speed of the processor.
_maxcycles = microsecondsToClockCycles(1000);
How exactly is this variable being utilized at any moment?
回答1:
How exactly is this variable being [utilized] at any moment?
It's not.
It's "ignored as the DHT reading algorithm adjusts itself base [sic] on the speed of the processor."
We can see in this commit that this wasn't the case in a previous version of the code.
Is this parameter necessary?
Presumably the interface has been maintained for binary stability.
This is perfectly normal and good. If the header file had any useful documenting comments they would point out that count
is now vestigial.
来源:https://stackoverflow.com/questions/35995195/dht11-adafruit-library-is-this-parameter-necessary