You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
Memory is indeed an issue, (think UNO) two possible solutions (?)
put the address array in PROGMEM => contra: only compile time possible, maybe even AVR specific
use compression. The addresses of DS18B20 consist of 8 bytes from which 6 are the unique ID, the other two indicate the type and are always the same. That means that you do not need to store them, effectively a 25% compression.
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 newgetAddresses
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.
The text was updated successfully, but these errors were encountered: