Skip to content

Commit

Permalink
[flight_plan] remerber last block, and return either to beginning of …
Browse files Browse the repository at this point in the history
…last block or continue last block
  • Loading branch information
dewagter committed Oct 20, 2016
1 parent a69fcc4 commit 3d3a30c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion conf/flight_plans/flight_plan.dtd
Expand Up @@ -310,4 +310,5 @@ default_value CDATA #IMPLIED>

<!ATTLIST header>

<!ATTLIST return>
<!ATTLIST return
reset_stage CDATA #IMPLIED>
3 changes: 2 additions & 1 deletion sw/airborne/subsystems/navigation/common_flight_plan.c
Expand Up @@ -54,5 +54,6 @@ void nav_goto_block(uint8_t b)
last_block = nav_block;
last_stage = nav_stage;
}
GotoBlock(b);
nav_block = b;
nav_init_block();
}
6 changes: 3 additions & 3 deletions sw/airborne/subsystems/navigation/common_flight_plan.h
Expand Up @@ -44,8 +44,8 @@ void nav_goto_block(uint8_t block_id);
#define InitStage() nav_init_stage();

#define Block(x) case x: nav_block=x;
#define NextBlock() { nav_block++; nav_init_block(); }
#define GotoBlock(b) { nav_block=b; nav_init_block(); }
#define NextBlock() nav_goto_block(nav_block + 1)
#define GotoBlock(b) nav_goto_block(b)

#define Stage(s) case s: nav_stage=s;
#define NextStage() { nav_stage++; InitStage(); }
Expand All @@ -54,7 +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 Return(x) { nav_block=last_block; if (x==1) {nav_stage=0;} else {nav_stage=last_stage;} block_time=0;}

#define And(x, y) ((x) && (y))
#define Or(x, y) ((x) || (y))
Expand Down
2 changes: 1 addition & 1 deletion sw/tools/generators/gen_flight_plan.ml
Expand Up @@ -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_or_default x "reset_stage" "0");
lprintf "break;\n"
| "goto" ->
stage ();
Expand Down

0 comments on commit 3d3a30c

Please sign in to comment.