I'm not sure about the code size but it is fairly long function.
If there is only one sensor on the bus you can issue a SKIP ROM command and "broadcast"
to any device. That is what the code I provided does so there is no need to mess with searching
or addresses.
(updated previous code example to be a little more informative)
If using the OneWire library you can do the same by using the skip() function.
It would be a quick and easy test on this code to simply eliminate this:
byte addr[8];
if ( !ds.search(addr))
{
ds.reset_search();
return -1000;
}
And then change this:
ds.select(addr);
to this:
ds.skip();
in the getTemp() function.
--- bill