#include "Copter.h"
#if AP_LANDINGGEAR_ENABLED
void Copter::landinggear_update()
{
if (!SRV_Channels::function_assigned(SRV_Channel::k_landing_gear_control)) {
return;
}
float height_m = flightmode->get_alt_above_ground_m();
#if AP_RANGEFINDER_ENABLED
switch (rangefinder.status_orient(ROTATION_PITCH_270)) {
case RangeFinder::Status::NotConnected:
case RangeFinder::Status::NoData:
break;
case RangeFinder::Status::OutOfRangeLow:
height_m = 0;
break;
case RangeFinder::Status::OutOfRangeHigh:
case RangeFinder::Status::Good:
height_m = rangefinder_state.alt_m_filt.get();
break;
}
#endif
landinggear.update(height_m);
}
#endif