Open mitchyboy9 opened 6 months ago
Thanks, Not reviewed it in depth. One question pops up. what happens if devices is not set before call to validAddress()? Can that happen?
This is a good concern, but I think we're fine because devices
is initialised to zero when setOneWire
is called, which is called by the constructor.
This change addresses #229. I ran into the same problem described in that issue while using the Multiple.ino example.
I only had 1 sensor connected, but was confusingly getting temperature readings for both the sensors declared in the example. I had received the "Unable to find address for Device 1" output from the Setup() method but the code used the address for my single sensor as the address for the nonexistent sensor.
Output from Multiple.ino example (with only 1 DS18B20 connected) before this change. Notice that device address
2861640AF24BE40D
is used twice:Output from Multiple.ino example (with only 1 DS18B20 connected) after this change. The nonexistent sensor is now given the address
0000000000000000
: