suppressed logging of invalid values in 1wire protocol

This commit is contained in:
Steffen Vogel 2011-08-05 01:27:45 +02:00
parent 91145f4c83
commit 3490213877

View file

@ -56,16 +56,19 @@ reading_t onewire_get(void *handle) {
reading_t rd; reading_t rd;
char buffer[16]; char buffer[16];
int bytes; int bytes;
rewind((FILE *) handle);
bytes = fread(buffer, 1, 16, (FILE *) handle); do {
rewind((FILE *) handle);
if (bytes) { bytes = fread(buffer, 1, 16, (FILE *) handle);
print(4, "Read from sensor file: %s", NULL, buffer);
if (bytes) {
rd.value = strtof(buffer, NULL); print(4, "Read from sensor file: %s", NULL, buffer);
gettimeofday(&rd.tv, NULL);
} rd.value = strtof(buffer, NULL);
gettimeofday(&rd.tv, NULL);
}
} while (rd.value == 85) { /* skip invalid readings */
return rd; return rd;
} }