HomePos: check corresponding validity before using data

This commit is contained in:
bresch
2020-12-07 10:24:23 -05:00
committed by Daniel Agar
parent 711bd2ce87
commit 3276916df9
3 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -295,9 +295,11 @@ build_gps_response(uint8_t *buffer, size_t *size)
memset(&home, 0, sizeof(home));
orb_copy(ORB_ID(home_position), _home_sub, &home);
_home_lat = home.lat;
_home_lon = home.lon;
_home_position_set = true;
if (home.valid_hpos) {
_home_lat = home.lat;
_home_lon = home.lon;
_home_position_set = true;
}
}
/* Distance from home */