mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-28 09:58:23 +08:00
[settings] group system settings under the same tab
This commit is contained in:
+5
-4
@@ -151,9 +151,9 @@ print_version:
|
|||||||
@echo "Paparazzi version" $(GIT_DESC)$(VERSION_MATCH)
|
@echo "Paparazzi version" $(GIT_DESC)$(VERSION_MATCH)
|
||||||
@echo "-----------------------------------------------------------------------"
|
@echo "-----------------------------------------------------------------------"
|
||||||
|
|
||||||
all_ac_h: $(SRCS_LIST) qt_project autopilot_h
|
all_ac_h: $(SRCS_LIST) qt_project
|
||||||
|
|
||||||
$(SRCS_LIST) : $(CONF_XML) $(AIRFRAME_H) $(MODULES_H) $(SETTINGS_H) $(MAKEFILE_AC) $(PERIODIC_H)
|
$(SRCS_LIST) : $(CONF_XML) $(AIRFRAME_H) $(MODULES_H) autopilot_h $(SETTINGS_H) $(MAKEFILE_AC) $(PERIODIC_H)
|
||||||
@echo "TARGET: " $(TARGET) > $(SRCS_LIST)
|
@echo "TARGET: " $(TARGET) > $(SRCS_LIST)
|
||||||
@echo "CFLAGS: " $(CFLAGS) >> $(SRCS_LIST)
|
@echo "CFLAGS: " $(CFLAGS) >> $(SRCS_LIST)
|
||||||
@echo "LDFLAGS: " $($(TARGET).LDFLAGS) >> $(SRCS_LIST)
|
@echo "LDFLAGS: " $($(TARGET).LDFLAGS) >> $(SRCS_LIST)
|
||||||
@@ -219,11 +219,12 @@ $(FLIGHT_PLAN_XML) : $(CONF)/$(FLIGHT_PLAN) $(CONF_XML) $(GENERATORS)/gen_flight
|
|||||||
$(Q)mv $($@_TMP) $@
|
$(Q)mv $($@_TMP) $@
|
||||||
$(Q)chmod a+r $@
|
$(Q)chmod a+r $@
|
||||||
|
|
||||||
$(SETTINGS_H) : $(SETTINGS_XMLS_DEP) $(CONF_XML) $(SETTINGS_MODULES) $(SETTINGS_TELEMETRY) $(GENERATORS)/gen_settings.out
|
# split system settings (generated) from user settings with a '--'
|
||||||
|
$(SETTINGS_H) : $(SETTINGS_XMLS_DEP) $(CONF_XML) $(SETTINGS_MODULES) $(SETTINGS_TELEMETRY) $(GENERATORS)/gen_settings.out autopilot_h
|
||||||
$(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED)
|
$(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED)
|
||||||
@echo GENERATE $@
|
@echo GENERATE $@
|
||||||
$(eval $@_TMP := $(shell $(MKTEMP)))
|
$(eval $@_TMP := $(shell $(MKTEMP)))
|
||||||
$(Q)$(GENERATORS)/gen_settings.out $(SETTINGS_XML) $(SETTINGS_TELEMETRY) $(SETTINGS_XMLS) $(SETTINGS_FLIGHTPLAN) $(SETTINGS_MODULES) > $($@_TMP)
|
$(Q)$(GENERATORS)/gen_settings.out $(SETTINGS_XML) $(SETTINGS_AUTOPILOT) $(SETTINGS_TELEMETRY) $(SETTINGS_FLIGHTPLAN) $(SETTINGS_MODULES) -- $(SETTINGS_XMLS) > $($@_TMP)
|
||||||
$(Q)mv $($@_TMP) $@
|
$(Q)mv $($@_TMP) $@
|
||||||
$(Q)chmod a+r $@
|
$(Q)chmod a+r $@
|
||||||
$(Q)cp $(SETTINGS_XMLS_DEP) $(AIRCRAFT_CONF_DIR)/settings
|
$(Q)cp $(SETTINGS_XMLS_DEP) $(AIRCRAFT_CONF_DIR)/settings
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ let supports_target = fun t targets ->
|
|||||||
else
|
else
|
||||||
Str.string_match (Str.regexp (".*"^t^".*")) targets 0
|
Str.string_match (Str.regexp (".*"^t^".*")) targets 0
|
||||||
|
|
||||||
let join_xml_files = fun xml_files ->
|
let join_xml_files = fun xml_sys_files xml_user_files ->
|
||||||
let dl_settings = ref []
|
let dl_settings = ref []
|
||||||
and rc_settings = ref [] in
|
and rc_settings = ref [] in
|
||||||
let target = try Sys.getenv "TARGET" with _ -> "" in
|
let target = try Sys.getenv "TARGET" with _ -> "" in
|
||||||
@@ -348,7 +348,18 @@ let join_xml_files = fun xml_files ->
|
|||||||
| Not_found -> [] in
|
| Not_found -> [] in
|
||||||
rc_settings := these_rc_settings @ !rc_settings;
|
rc_settings := these_rc_settings @ !rc_settings;
|
||||||
dl_settings := these_dl_settings @ !dl_settings)
|
dl_settings := these_dl_settings @ !dl_settings)
|
||||||
xml_files;
|
xml_user_files;
|
||||||
|
|
||||||
|
(* add system settings grouped under the same tab *)
|
||||||
|
let dl_sys = List.map (fun xml_file ->
|
||||||
|
let xml = ExtXml.parse_file xml_file in
|
||||||
|
(* take "second stage" dl_settings nodes *)
|
||||||
|
let dl = ExtXml.child xml "dl_settings" in
|
||||||
|
Xml.children dl
|
||||||
|
) xml_sys_files in
|
||||||
|
dl_settings := Xml.Element("dl_settings", [("name", "System")], List.rev (List.flatten dl_sys)) :: !dl_settings;
|
||||||
|
|
||||||
|
(* return final node *)
|
||||||
Xml.Element("rc_settings",[],!rc_settings), Xml.Element("dl_settings",[],!dl_settings)
|
Xml.Element("rc_settings",[],!rc_settings), Xml.Element("dl_settings",[],!dl_settings)
|
||||||
|
|
||||||
|
|
||||||
@@ -357,13 +368,16 @@ let _ =
|
|||||||
if Array.length Sys.argv < 4 then
|
if Array.length Sys.argv < 4 then
|
||||||
failwith (Printf.sprintf "Usage: %s output_xml_file input_xml_file(s) input_xml_modules" Sys.argv.(0));
|
failwith (Printf.sprintf "Usage: %s output_xml_file input_xml_file(s) input_xml_modules" Sys.argv.(0));
|
||||||
let h_name = "SETTINGS_H"
|
let h_name = "SETTINGS_H"
|
||||||
and xml_files = ref [] in
|
and xml_files = Array.to_list (Array.sub Sys.argv 2 (Array.length Sys.argv - 2)) in
|
||||||
for i = 2 to Array.length Sys.argv - 1 do
|
(* split system settings and user settings based on '*' separator *)
|
||||||
xml_files := Sys.argv.(i) :: !xml_files;
|
let xml_sys_files, xml_user_files, _ = List.fold_left (fun (sys, user, delim) x ->
|
||||||
done;
|
if x = "--" then (sys, user, true)
|
||||||
|
else if delim then (sys, x :: user, delim)
|
||||||
|
else (x :: sys, user, delim)) ([], [], false) xml_files
|
||||||
|
in
|
||||||
|
|
||||||
try
|
try
|
||||||
printf "/* This file has been generated by gen_settings from %s */\n" (String.concat " " !xml_files);
|
printf "/* This file has been generated by gen_settings from %s */\n" (String.concat " " xml_files);
|
||||||
printf "/* Version %s */\n" (Env.get_paparazzi_version ());
|
printf "/* Version %s */\n" (Env.get_paparazzi_version ());
|
||||||
printf "/* Please DO NOT EDIT */\n\n";
|
printf "/* Please DO NOT EDIT */\n\n";
|
||||||
|
|
||||||
@@ -371,7 +385,7 @@ let _ =
|
|||||||
define h_name "";
|
define h_name "";
|
||||||
nl ();
|
nl ();
|
||||||
|
|
||||||
let rc_settings, dl_settings = join_xml_files !xml_files in
|
let rc_settings, dl_settings = join_xml_files xml_sys_files xml_user_files in
|
||||||
|
|
||||||
let xml = Xml.Element ("settings", [], [rc_settings; dl_settings]) in
|
let xml = Xml.Element ("settings", [], [rc_settings; dl_settings]) in
|
||||||
let f = open_out Sys.argv.(1) in
|
let f = open_out Sys.argv.(1) in
|
||||||
|
|||||||
Reference in New Issue
Block a user