suppressed logging of invalid values in 1wire protocol
This commit is contained in:
parent
91145f4c83
commit
3490213877
1 changed files with 14 additions and 11 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue