2015-02-16 00:39:18 -04:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
//
|
|
|
|
// functions to support precision landing
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Copter.h"
|
|
|
|
|
|
|
|
#if PRECISION_LANDING == ENABLED
|
|
|
|
|
|
|
|
void Copter::init_precland()
|
|
|
|
{
|
|
|
|
copter.precland.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Copter::update_precland()
|
|
|
|
{
|
2015-09-11 06:15:02 -03:00
|
|
|
float final_alt = current_loc.alt;
|
|
|
|
|
|
|
|
// use range finder altitude if it is valid
|
2016-04-27 09:18:35 -03:00
|
|
|
if (rangefinder_alt_ok()) {
|
2016-05-07 04:55:40 -03:00
|
|
|
final_alt = rangefinder_state.alt_cm;
|
2015-09-11 06:15:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
copter.precland.update(final_alt);
|
2015-02-16 00:39:18 -04:00
|
|
|
|
|
|
|
// log output
|
|
|
|
Log_Write_Precland();
|
|
|
|
}
|
|
|
|
#endif
|