AP_HAL_Linux: fix compiler warning in AnalogIn_IIO

This commit is contained in:
mirkix 2017-01-26 11:27:21 +01:00 committed by Lucas De Marchi
parent 99ba42c26d
commit ad7e21b860
1 changed files with 4 additions and 1 deletions

View File

@ -71,7 +71,10 @@ float AnalogSource_IIO::read_latest()
}
memset(sbuf, 0, sizeof(sbuf));
pread(_pin_fd, sbuf, sizeof(sbuf) - 1, 0);
if (pread(_pin_fd, sbuf, sizeof(sbuf) - 1, 0) < 0) {
_latest = 0;
return 0;
}
_latest = atoi(sbuf) * _voltage_scaling;
_sum_value += _latest;
_sum_count++;