2019-06-18 15:29:05 -03:00
|
|
|
//
|
|
|
|
// functions to support precision landing
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Copter.h"
|
|
|
|
|
|
|
|
#if PRECISION_LANDING == ENABLED
|
|
|
|
|
|
|
|
void Copter::init_precland()
|
|
|
|
{
|
|
|
|
copter.precland.init(400);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Copter::update_precland()
|
|
|
|
{
|
|
|
|
int32_t height_above_ground_cm = current_loc.alt;
|
|
|
|
|
2019-12-11 23:55:45 -04:00
|
|
|
// use range finder altitude if it is valid, otherwise use home alt
|
2019-06-18 15:29:05 -03:00
|
|
|
if (rangefinder_alt_ok()) {
|
|
|
|
height_above_ground_cm = rangefinder_state.alt_cm;
|
|
|
|
}
|
|
|
|
|
|
|
|
precland.update(height_above_ground_cm, rangefinder_alt_ok());
|
|
|
|
}
|
|
|
|
#endif
|