AP_OpticalFlow: remove num_errors increment due to busy bus

num_errors should be used to detect bad bus transfers, not if we
actually read something. Since we are using i2c_sem->take_nonblocking()
failing here is more likely if the bus is shared.
This commit is contained in:
Lucas De Marchi 2015-11-02 13:03:55 -02:00 committed by Randy Mackay
parent 41ddb67712
commit 7b726d824d

View File

@ -86,13 +86,11 @@ bool AP_OpticalFlow_Linux::read(optical_flow_s* report)
// get pointer to i2c bus semaphore
AP_HAL::Semaphore *i2c_sem = hal.i2c->get_semaphore();
if (i2c_sem == NULL) {
num_errors++;
return false;
}
// take i2c bus sempahore (non blocking)
if (!i2c_sem->take_nonblocking()) {
num_errors++;
return false;
}