Plane: replace range finder health with status

This commit is contained in:
Randy Mackay 2015-04-17 15:37:00 +09:00
parent a01fb64f12
commit 0acc4af63c
2 changed files with 3 additions and 4 deletions

View File

@ -285,7 +285,7 @@ static NOINLINE void send_extended_status1(mavlink_channel_t chan)
if (g.rangefinder_landing) {
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
}
if (rangefinder.healthy()) {
if (rangefinder.has_data()) {
control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
}
}
@ -470,7 +470,7 @@ static void NOINLINE send_wind(mavlink_channel_t chan)
static void NOINLINE send_rangefinder(mavlink_channel_t chan)
{
if (!rangefinder.healthy()) {
if (!rangefinder.has_data()) {
// no sonar to report
return;
}

View File

@ -547,9 +547,8 @@ static float rangefinder_correction(void)
static void rangefinder_height_update(void)
{
uint16_t distance_cm = rangefinder.distance_cm();
int16_t max_distance_cm = rangefinder.max_distance_cm();
float height_estimate = 0;
if (rangefinder.healthy() && distance_cm < max_distance_cm && home_is_set != HOME_UNSET) {
if ((rangefinder.status() == RangeFinder::RangeFinder_Good) && home_is_set != HOME_UNSET) {
// correct the range for attitude (multiply by DCM.c.z, which
// is cos(roll)*cos(pitch))
height_estimate = distance_cm * 0.01f * ahrs.get_dcm_matrix().c.z;