AP_RangeFinder: fixed TeraRangerI2C refresh rate and status

This commit is contained in:
Adolfo 2019-03-09 15:41:44 +01:00 committed by Peter Barker
parent ec1b6db83b
commit 428d4d4574

View File

@ -105,7 +105,7 @@ bool AP_RangeFinder_TeraRangerI2C::init(void)
dev->set_retries(1);
dev->register_periodic_callback(50000,
dev->register_periodic_callback(10000,
FUNCTOR_BIND_MEMBER(&AP_RangeFinder_TeraRangerI2C::timer, void));
return true;
@ -158,7 +158,7 @@ bool AP_RangeFinder_TeraRangerI2C::process_raw_measure(uint16_t raw_distance, ui
}
/*
timer called at 20Hz
timer called at 100Hz, EVO sensors max freq is 100..240Hz
*/
void AP_RangeFinder_TeraRangerI2C::timer(void)
{
@ -191,7 +191,7 @@ void AP_RangeFinder_TeraRangerI2C::update(void)
accum.sum = 0;
accum.count = 0;
update_status();
} else {
} else if (AP_HAL::millis() - state.last_reading_ms > 200) {
set_status(RangeFinder::RangeFinder_NoData);
}
}