HAL_SITL: fixed SITL example progs

This commit is contained in:
Andrew Tridgell 2018-11-04 16:31:04 +11:00
parent 329357f7a2
commit 5480479e73
1 changed files with 5 additions and 0 deletions

View File

@ -508,6 +508,11 @@ void SITL_State::set_height_agl(void)
{
static float home_alt = -1;
if (!_sitl) {
// in example program
return;
}
if (is_equal(home_alt, -1.0f) && _sitl->state.altitude > 0) {
// remember home altitude as first non-zero altitude
home_alt = _sitl->state.altitude;