0

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?

Womble
  • 345
  • 3
  • 13

1 Answers1

0

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.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • Thank you, that's a perfect explanation! – Womble Mar 14 '16 at 18:37
  • @Tamburillac: I try :) – Lightness Races in Orbit Mar 14 '16 at 18:38
  • Can you tell me a bit about this binary stability? Wouldn't it be wise to remove the parameter for simplicities sake? – Womble Mar 14 '16 at 18:40
  • @Tamburillac: It's a _lot_ more simple in the grand scheme of things not to. Otherwise your library is no longer compatible with any application using it; you have to release a whole new version and ensure that applications that use the new header don't link to the old library. You don't want to go changing the public interface of a library unless you _really_ need to. For the sake of a single `uint8_t`, it's a lot easier to just ignore the argument. – Lightness Races in Orbit Mar 14 '16 at 18:49
  • Interesting thought, I'll keep that in mind (: Thanks again. – Womble Mar 14 '16 at 18:52