1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

WP Mission Landing Elevation Setting (#6822)

* Initial build

* Fix p1 error + change cm to meters

* Update navigation.c

Add correction if absolute SL landing elevation used (related PR #6662)
This commit is contained in:
breadoven 2021-05-03 16:14:02 +01:00 committed by GitHub
parent 854732566d
commit 40f23445f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1875,6 +1875,13 @@ static fpVector3_t * rthGetHomeTargetPosition(rthTargetMode_e mode)
break; break;
case RTH_HOME_FINAL_LAND: case RTH_HOME_FINAL_LAND:
// if WP mission p2 > 0 use p2 value as landing elevation (in meters !) (otherwise default to takeoff home elevation)
if (FLIGHT_MODE(NAV_WP_MODE) && posControl.waypointList[posControl.activeWaypointIndex].action == NAV_WP_ACTION_LAND && posControl.waypointList[posControl.activeWaypointIndex].p2 != 0) {
posControl.rthState.homeTmpWaypoint.z = posControl.waypointList[posControl.activeWaypointIndex].p2 * 100; // 100 -> m to cm
if (waypointMissionAltConvMode(posControl.waypointList[posControl.activeWaypointIndex].p3) == GEO_ALT_ABSOLUTE) {
posControl.rthState.homeTmpWaypoint.z -= posControl.gpsOrigin.alt; // correct to relative if absolute SL altitude datum used
}
}
break; break;
} }