RangeFinder_MaxSonar: set status

This commit is contained in:
Randy Mackay 2015-04-13 15:08:00 +09:00
parent e212ebb0d0
commit fadfa70e99

View File

@ -116,5 +116,10 @@ bool AP_RangeFinder_MaxsonarI2CXL::get_reading(uint16_t &reading_cm)
*/
void AP_RangeFinder_MaxsonarI2CXL::update(void)
{
state.healthy = get_reading(state.distance_cm);
if (get_reading(state.distance_cm)) {
// update range_valid state based on distance measured
update_status();
} else {
set_status(RangeFinder::RangeFinder_NoData);
}
}