mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 01:11:10 +03:00
This is a combination of 2 commits.
aio: mraa_aio_read (v1.0.0) can now return -1, treat that in sensors using it Adds alot of exceptions if the aio read goes wrong Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:

committed by
Noel Eck

parent
f6816797bb
commit
e51c5f3018
@ -92,6 +92,10 @@ float OTP538U::ambientTemperature()
|
||||
for (int i=0; i<samples; i++)
|
||||
{
|
||||
val = mraa_aio_read(m_aioA);
|
||||
if (val == -1) {
|
||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||
": failed to do aio read");
|
||||
}
|
||||
temp += val;
|
||||
usleep(10000);
|
||||
}
|
||||
@ -153,6 +157,11 @@ float OTP538U::objectTemperature()
|
||||
for (int i=0; i<samples; i++)
|
||||
{
|
||||
val = mraa_aio_read(m_aioO);
|
||||
if (val == -1) {
|
||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||
": failed to do aio read.");
|
||||
return 0;
|
||||
}
|
||||
temp += val;
|
||||
usleep(10000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user