DHT11 Adafruit Library: Is this parameter necessary?

二次信任 提交于 2019-12-13 05:35:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!