Copter: stop changing frame to home when home not set

This commit is contained in:
Peter Barker 2019-03-15 08:54:32 +11:00 committed by Randy Mackay
parent 08a18d6a0a
commit 17060d5d66
1 changed files with 4 additions and 5 deletions

View File

@ -15,13 +15,12 @@ void Copter::read_inertia()
return;
}
Location::AltFrame frame;
if (ahrs.home_is_set()) {
frame = Location::AltFrame::ABOVE_HOME;
current_loc.set_alt_cm(inertial_nav.get_altitude(),
Location::AltFrame::ABOVE_HOME);
} else {
// without home use alt above the EKF origin
frame = Location::AltFrame::ABOVE_ORIGIN;
current_loc.set_alt_cm(inertial_nav.get_altitude(),
Location::AltFrame::ABOVE_ORIGIN);
}
current_loc.set_alt_cm(inertial_nav.get_altitude(), frame);
current_loc.change_alt_frame(Location::AltFrame::ABOVE_HOME);
}