[tools] generated MODULES_FREQUENCY defaults to PERIODIC_FREQUENCY

This commit is contained in:
Felix Ruess
2013-09-13 11:28:41 +02:00
parent ae0a26a45a
commit 6ea53c5c15
2 changed files with 15 additions and 6 deletions
+10 -2
View File
@@ -64,11 +64,19 @@ Q=@
#
ifeq ($(MAKECMDGOALS),all_ac_h)
-include $(MAKEFILE_AC)
endif
# telemetry periodic frequency defaults to 60Hz
TELEMETRY_FREQUENCY ?= 60
ifdef PERIODIC_FREQUENCY
DEFAULT_MODULES_FREQUENCY = $(PERIODIC_FREQUENCY)
else
$(error Error: PERIODIC_FREQUENCY not configured)
endif
endif
init:
@[ -d $(PAPARAZZI_HOME) ] || (echo "Copying config example in your $(PAPARAZZI_HOME) directory"; mkdir -p $(PAPARAZZI_HOME); cp -a conf $(PAPARAZZI_HOME); cp -a data $(PAPARAZZI_HOME); mkdir -p $(PAPARAZZI_HOME)/var/maps; mkdir -p $(PAPARAZZI_HOME)/var/include)
@@ -147,7 +155,7 @@ $(MODULES_H) : $(CONF)/$(AIRFRAME_XML) $(TOOLS)/gen_modules.out $(CONF)/modules/
$(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED)
@echo GENERATE $@
$(eval $@_TMP := $(shell $(MKTEMP)))
$(Q)$(TOOLS)/gen_modules.out $(SETTINGS_MODULES) $< > $($@_TMP)
$(Q)$(TOOLS)/gen_modules.out $(SETTINGS_MODULES) $(DEFAULT_MODULES_FREQUENCY) $< > $($@_TMP)
$(Q)mv $($@_TMP) $@
$(Q)chmod a+r $@
+5 -4
View File
@@ -344,9 +344,10 @@ let write_settings = fun xml_file out_set modules ->
let h_name = "MODULES_H"
let () =
if Array.length Sys.argv <> 3 then
failwith (Printf.sprintf "Usage: %s out_settings_file xml_file" Sys.argv.(0));
let xml_file = Sys.argv.(2)
if Array.length Sys.argv <> 4 then
failwith (Printf.sprintf "Usage: %s out_settings_file default_freq xml_file" Sys.argv.(0));
let xml_file = Sys.argv.(3)
and default_freq = int_of_string(Sys.argv.(2))
and out_set = open_out Sys.argv.(1) in
try
let xml = start_and_begin xml_file h_name in
@@ -357,7 +358,7 @@ let () =
nl ();
(* Extract main_freq parameter *)
let modules = try (ExtXml.child xml "modules") with _ -> Xml.Element("modules",[],[]) in
let main_freq = try (int_of_string (Xml.attrib modules "main_freq")) with _ -> !freq in
let main_freq = try (int_of_string (Xml.attrib modules "main_freq")) with _ -> default_freq in
freq := main_freq;
fprintf out_h "#define MODULES_FREQUENCY %d\n" !freq;
nl ();