From c4aa17a04c87f1746c037a07de71e44e01860037 Mon Sep 17 00:00:00 2001 From: abeck70 Date: Fri, 17 Apr 2015 23:06:02 +1000 Subject: [PATCH] OP-1760 autotakeoff pathplanner now uses pathstatus in conditionLegRemaining --- flight/modules/PathPlanner/pathplanner.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/flight/modules/PathPlanner/pathplanner.c b/flight/modules/PathPlanner/pathplanner.c index 7a50910d8..e29e8b1d1 100644 --- a/flight/modules/PathPlanner/pathplanner.c +++ b/flight/modules/PathPlanner/pathplanner.c @@ -555,18 +555,10 @@ static uint8_t conditionDistanceToTarget() */ static uint8_t conditionLegRemaining() { - PathDesiredData pathDesired; - PositionStateData positionState; + PathStatusData pathStatus; + PathStatusGet(&pathStatus); - PathDesiredGet(&pathDesired); - PositionStateGet(&positionState); - - float cur[3] = { positionState.North, positionState.East, positionState.Down }; - struct path_status progress; - - path_progress(&pathDesired, - cur, &progress, mode3D); - if (progress.fractional_progress >= 1.0f - pathAction.ConditionParameters[0]) { + if (pathStatus.fractional_progress >= (1.0f - pathAction.ConditionParameters[0])) { return true; } return false;