I'm not a typical setup, so it's unlikely that what I do to eventually solve this problem is useful to others, but my code adjustment might me useful.
Here's my setup: Ubuntu 10.04 LTS, AAG TAI603B USB-1wire adapter but connected to the legacy Dallas 1-wire station (version 1). This creates some unique challenges, no doubt.
Anyway, the coding fix I implemented involves RETRIES. I've setup a constant retryCount for retries before giving up... 10 seems to be a good value.
Here is a snippet:
- Code: Select all
// humidity ============================================================
retries = 0;
while (retries < retryCount)
{
humidity = hs1.getHumidity(); // If we get a good reading, just take it.
if (humidity == -999.0f) // otherwise, try a few times to see if we get a good reading.
{
System.out.println("*** OOPS Retry # " + retries + "***");
humidity = hs1.getHumidity();
} else {
break;
}
retries ++;
}
I was able to do this for all sensors as Tim set up the code to use return values similar to -999.9. If we see one... which means "wrong", a retry can be made till we don't... or give up after X tries.
