[flight_plan] remerber last block, and return either to beginning of last block or continue last block (#1885)

This commit is contained in:
Christophe De Wagter
2016-10-12 11:35:14 +02:00
committed by Gautier Hattenberger
parent b57d8bc013
commit 4acd680ccf
4 changed files with 8 additions and 6 deletions
+2 -1
View File
@@ -310,4 +310,5 @@ default_value CDATA #IMPLIED>
<!ATTLIST header> <!ATTLIST header>
<!ATTLIST return> <!ATTLIST return
reset_stage CDATA #IMPLIED>
@@ -54,5 +54,6 @@ void nav_goto_block(uint8_t b)
last_block = nav_block; last_block = nav_block;
last_stage = nav_stage; last_stage = nav_stage;
} }
GotoBlock(b); nav_block = b;
nav_init_block();
} }
@@ -44,8 +44,8 @@ void nav_goto_block(uint8_t block_id);
#define InitStage() nav_init_stage(); #define InitStage() nav_init_stage();
#define Block(x) case x: nav_block=x; #define Block(x) case x: nav_block=x;
#define NextBlock() { nav_block++; nav_init_block(); } #define NextBlock() nav_goto_block(nav_block + 1)
#define GotoBlock(b) { nav_block=b; nav_init_block(); } #define GotoBlock(b) nav_goto_block(b)
#define Stage(s) case s: nav_stage=s; #define Stage(s) case s: nav_stage=s;
#define NextStage() { nav_stage++; InitStage(); } #define NextStage() { nav_stage++; InitStage(); }
@@ -54,7 +54,7 @@ void nav_goto_block(uint8_t block_id);
#define Label(x) label_ ## x: #define Label(x) label_ ## x:
#define Goto(x) { goto 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 And(x, y) ((x) && (y))
#define Or(x, y) ((x) || (y)) #define Or(x, y) ((x) || (y))
+1 -1
View File
@@ -324,7 +324,7 @@ let rec print_stage = fun index_of_waypoints x ->
match String.lowercase (Xml.tag x) with match String.lowercase (Xml.tag x) with
"return" -> "return" ->
stage (); stage ();
lprintf "Return();\n"; lprintf "Return(%s);\n" (ExtXml.attrib_or_default x "reset_stage" "0");
lprintf "break;\n" lprintf "break;\n"
| "goto" -> | "goto" ->
stage (); stage ();