From 6364bb85665ac4870e4d4f77cfd0cf2571c43654 Mon Sep 17 00:00:00 2001 From: "U-karat-jdl\\karat" Date: Thu, 29 Nov 2018 12:20:53 +0200 Subject: [PATCH] LP-605 call setWaypoint() on PathPlan resume --- flight/modules/PathPlanner/pathplanner.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flight/modules/PathPlanner/pathplanner.c b/flight/modules/PathPlanner/pathplanner.c index 0faeeafe2..b10bd2f4e 100644 --- a/flight/modules/PathPlanner/pathplanner.c +++ b/flight/modules/PathPlanner/pathplanner.c @@ -222,7 +222,8 @@ static void pathPlannerTask() } // the transition from pathplanner to another flightmode back to pathplanner - // triggers a reset back to 0 index in the waypoint list + // triggers a reset back either to 0 index in the waypoint list, + // or to current index in the waypoint list, depending on FlightModeChangeRestartsPathPlan setting if (pathplanner_active == false) { pathplanner_active = true; @@ -230,8 +231,11 @@ static void pathPlannerTask() FlightModeSettingsFlightModeChangeRestartsPathPlanGet(&restart); if (restart == FLIGHTMODESETTINGS_FLIGHTMODECHANGERESTARTSPATHPLAN_TRUE) { setWaypoint(0); - return; } + else { + setWaypoint(waypointActive.Index); + } + return; } WaypointInstGet(waypointActive.Index, &waypoint);