AP_Compass: LSM303D: check for overruns in compass values

This commit is contained in:
Lucas De Marchi 2016-03-21 12:07:52 -03:00
parent cf2d866d51
commit 46936767c1
1 changed files with 5 additions and 0 deletions

View File

@ -236,6 +236,11 @@ bool AP_Compass_LSM303D::_read_sample()
return false;
}
/* check for overrun */
if ((rx.status & 0x70) != 0) {
return false;
}
if (is_zero(rx.x) && is_zero(rx.y) && is_zero(rx.z)) {
return false;
}