AP_AHRS: add sanity checks for home location being set

This commit is contained in:
Peter Barker 2019-02-13 13:46:36 +11:00 committed by Peter Barker
parent a722fd1323
commit ab9c084179
1 changed files with 8 additions and 0 deletions

View File

@ -1033,6 +1033,14 @@ bool AP_AHRS_DCM::airspeed_estimate(float *airspeed_ret) const
bool AP_AHRS_DCM::set_home(const Location &loc)
{
// check location is valid
if (loc.lat == 0 && loc.lng == 0 && loc.alt == 0) {
return false;
}
if (!check_latlng(loc)) {
return false;
}
_home = loc;
_home_is_set = true;