mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
[generator] generate arrays of the settings and fp blocks names
not used yet, but it can be later to send the settings and block names to the ground of to implement to associate a name to an index at runtime
This commit is contained in:
@@ -785,6 +785,9 @@ let () =
|
||||
lprintf "};\n";
|
||||
Xml2h.define "NB_WAYPOINT" (string_of_int (List.length waypoints));
|
||||
|
||||
Xml2h.define "FP_BLOCKS" "{ \\";
|
||||
List.iter (fun b -> printf " { \"%s\" }, \\\n" (ExtXml.attrib b "name")) blocks;
|
||||
lprintf "};\n";
|
||||
Xml2h.define "NB_BLOCK" (string_of_int (List.length blocks));
|
||||
|
||||
Xml2h.define "GROUND_ALT" (sof !ground_alt);
|
||||
@@ -794,15 +797,6 @@ let () =
|
||||
Xml2h.define "HOME_MODE_HEIGHT" (sof home_mode_height);
|
||||
Xml2h.define "MAX_DIST_FROM_HOME" (sof mdfh);
|
||||
|
||||
(** Print defines for blocks **)
|
||||
lprintf "\n";
|
||||
let idx = ref 0 in
|
||||
List.iter
|
||||
(fun s ->
|
||||
let v = ExtXml.attrib s "name" in
|
||||
lprintf "#define BLOCK_%s %d\n" (Str.global_replace (Str.regexp "[^A-Za-z0-9]") "_" v) !idx; incr idx) blocks;
|
||||
lprintf "\n";
|
||||
|
||||
let index_of_waypoints =
|
||||
let i = ref (-1) in
|
||||
List.map (fun w -> incr i; (name_of w, !i)) waypoints in
|
||||
|
||||
@@ -69,14 +69,10 @@ let print_dl_settings = fun settings ->
|
||||
lprintf "\n";
|
||||
|
||||
(** Datalink knowing what settings mean **)
|
||||
let idx = ref 0 in
|
||||
lprintf "\n";
|
||||
List.iter
|
||||
(fun s ->
|
||||
let v = ExtXml.attrib s "var" in
|
||||
lprintf "#define SETTINGS_%s %d\n" (Str.global_replace (Str.regexp "[^A-Za-z0-9]") "_" v) !idx; incr idx)
|
||||
settings;
|
||||
lprintf "\n";
|
||||
Xml2h.define "SETTINGS" "{ \\";
|
||||
List.iter (fun b -> printf " { \"%s\" }, \\\n" (ExtXml.attrib b "var")) settings;
|
||||
lprintf "};\n";
|
||||
Xml2h.define "NB_SETTING" (string_of_int (List.length settings));
|
||||
|
||||
(** Macro to call to set one variable *)
|
||||
lprintf "#define DlSetting(_idx, _value) { \\\n";
|
||||
|
||||
Reference in New Issue
Block a user