diff --git a/conf/modules/hackhd.xml b/conf/modules/hackhd.xml index a7fbbda993..e4c705794d 100644 --- a/conf/modules/hackhd.xml +++ b/conf/modules/hackhd.xml @@ -6,8 +6,21 @@ + - + + + + + + + + + + + + +
diff --git a/conf/modules/module.dtd b/conf/modules/module.dtd index 91b1439b41..350ede115e 100644 --- a/conf/modules/module.dtd +++ b/conf/modules/module.dtd @@ -1,8 +1,9 @@ - + - + + @@ -19,6 +20,10 @@ + + + + name CDATA #REQUIRED dir CDATA #IMPLIED> + + + + + + + + + diff --git a/sw/lib/ocaml/env.ml b/sw/lib/ocaml/env.ml index a6c1609229..5a557cdabf 100644 --- a/sw/lib/ocaml/env.ml +++ b/sw/lib/ocaml/env.ml @@ -56,6 +56,10 @@ let gcs_icons_path = paparazzi_home // "data" // "pictures" // "gcs_icons" let dump_fp = paparazzi_src // "sw" // "tools" // "generators" // "gen_flight_plan.out -dump" +let filter_absolute_path = fun path -> + Str.replace_first (Str.regexp (paparazzi_home // "conf/")) "" path + + (* filter settings and keep the ones without brackets *) let filter_settings = fun settings -> let sl = Str.split (Str.regexp "[ ]+") settings in diff --git a/sw/lib/ocaml/env.mli b/sw/lib/ocaml/env.mli index d8aa955056..54d9303088 100644 --- a/sw/lib/ocaml/env.mli +++ b/sw/lib/ocaml/env.mli @@ -48,6 +48,10 @@ val gconf_file : string val gcs_icons_path : string +val filter_absolute_path : string -> string +(** remove absolute path paparazzi_home/conf if it exists + * returns a relative path *) + val filter_settings : string -> string (** filter settings (a string separted by white spaces) * and keep the ones without brackets diff --git a/sw/supervision/pc_aircraft.ml b/sw/supervision/pc_aircraft.ml index f36b2dd4b1..2c1149d9db 100644 --- a/sw/supervision/pc_aircraft.ml +++ b/sw/supervision/pc_aircraft.ml @@ -163,13 +163,18 @@ let save_callback = fun ?user_save gui ac_combo tree tree_modules () -> let get_settings_modules = fun ac_xml settings_modules -> (* get modules *) let modules = Gen_common.get_modules_of_airframe ac_xml in - let modules = List.map (fun m -> m.Gen_common.xml ) modules in + let modules = List.map (fun m -> m.Gen_common.xml, m.Gen_common.file ) modules in (* get list of settings files *) - let settings = List.fold_left (fun l m -> - (* get list of settings xml node if any *) - let set_list = try Xml.children (ExtXml.child m "settings") with _ -> [] in + let settings = List.fold_left (fun l (m, f) -> + (* get list of settings_file xml node if any *) + let set_list = List.filter (fun t -> Xml.tag t = "settings_file") (Xml.children m) in let file_list = List.map (fun s -> "settings/"^(Xml.attrib s "name")) set_list in - l @ file_list + (* include module file in the list only if it has a 'settings' node *) + let module_file = + if List.exists (fun t -> Xml.tag t = "settings") (Xml.children m) + then [Env.filter_absolute_path f] + else [] in + l @ file_list @ module_file ) [] modules in (* store current state in a hashtable *) let current = Hashtbl.create 7 in @@ -279,7 +284,9 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo flash_com let settings_modules = try let af_xml = Xml.parse_file (Env.paparazzi_home // "conf" // (Xml.attrib aircraft "airframe")) in get_settings_modules af_xml (ExtXml.attrib_or_default aircraft "settings_modules" "") - with _ -> [] + with + | Failure x -> prerr_endline x; [] + | _ -> [] in (* update aicraft hashtable *) let aircraft = ExtXml.subst_attrib "settings_modules" (String.concat " " settings_modules) aircraft in diff --git a/sw/tools/generators/gen_settings.ml b/sw/tools/generators/gen_settings.ml index d87d457766..1b23f20ef2 100644 --- a/sw/tools/generators/gen_settings.ml +++ b/sw/tools/generators/gen_settings.ml @@ -275,7 +275,10 @@ let join_xml_files = fun xml_files -> try Xml.children (ExtXml.child xml "rc_settings") with Not_found -> [] in let these_dl_settings = - try Xml.children (ExtXml.child xml "dl_settings") with + try + (* test if the file is plain settings file or a module file *) + let xml = if Xml.tag xml = "module" then (ExtXml.child xml "settings") else xml in + Xml.children (ExtXml.child xml "dl_settings") with Not_found -> [] in rc_settings := these_rc_settings @ !rc_settings; dl_settings := these_dl_settings @ !dl_settings)