From eac214d08e14d5b43849167406b086a2767ee6f7 Mon Sep 17 00:00:00 2001 From: Christophe De Wagter Date: Fri, 7 Oct 2016 11:48:06 +0200 Subject: [PATCH] [return] reset_stage attribute --- conf/flight_plans/flight_plan.dtd | 3 ++- sw/airborne/subsystems/navigation/common_flight_plan.h | 3 +-- sw/tools/generators/gen_flight_plan.ml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/flight_plans/flight_plan.dtd b/conf/flight_plans/flight_plan.dtd index f5bd1a97d66..813cb4e0e1e 100644 --- a/conf/flight_plans/flight_plan.dtd +++ b/conf/flight_plans/flight_plan.dtd @@ -310,4 +310,5 @@ default_value CDATA #IMPLIED> - + diff --git a/sw/airborne/subsystems/navigation/common_flight_plan.h b/sw/airborne/subsystems/navigation/common_flight_plan.h index 170c74e40e5..2f56e87b866 100644 --- a/sw/airborne/subsystems/navigation/common_flight_plan.h +++ b/sw/airborne/subsystems/navigation/common_flight_plan.h @@ -54,8 +54,7 @@ void nav_goto_block(uint8_t block_id); #define Label(x) label_ ## x: #define Goto(x) { goto label_ ## x; } -#define Return() { nav_block=last_block; nav_stage=last_stage; block_time=0;} -#define ReturnToStartPrevBlock() { nav_block=last_block; nav_stage=0; block_time=0;} +#define Return(RESET_STAGE) { nav_block=last_block; if (RESET_STAGE==1) {nav_stage=0;} else {nav_stage=last_stage;} block_time=0;} #define And(x, y) ((x) && (y)) #define Or(x, y) ((x) || (y)) diff --git a/sw/tools/generators/gen_flight_plan.ml b/sw/tools/generators/gen_flight_plan.ml index 2a163cd9bdd..a10abe42eb1 100644 --- a/sw/tools/generators/gen_flight_plan.ml +++ b/sw/tools/generators/gen_flight_plan.ml @@ -324,7 +324,7 @@ let rec print_stage = fun index_of_waypoints x -> match String.lowercase (Xml.tag x) with "return" -> stage (); - lprintf "Return();\n"; + lprintf "Return(%s);\n" (ExtXml.attrib x "reset_stage"); lprintf "break;\n" | "goto" -> stage ();