Arduino-Temperature-Control-Library
Arduino-Temperature-Control-Library copied to clipboard
`getAddresses` additional to `getAddress(uint8_t* deviceAddress, uint8_t index)`
The most usual code flow (of what I've seen so far) is to get the number of devices and then iterate over them to get their address and finally to get the temperature. But getAddress
gets very slow for a number of about 15-20 sensors. It might help to request all addresses once via a new getAddresses
function and just re-use them.
Of course its possible to do this on your own code, but it's always nice if a library facilitates such things and points the user to a more efficient solution :)
Pro: Should be faster. It could be even less error-prone if sensors get replaced while getAddress
is run.
Contra: Devs might work with an out-of-date array of addresses; it should be therefore be well documented (e.g. "if you want to replace sensors, refresh addresses on every loop
).
As I'm working with an ESP32, I also thought about the library to just save an address array itself. But as most Arduinos have a serious memory issue, that might be unwise.