diff --git a/Makefile.ac b/Makefile.ac index b8b4a941bc..8ecc58ab29 100644 --- a/Makefile.ac +++ b/Makefile.ac @@ -174,11 +174,11 @@ $(RADIO_H) : $(CONF)/$(RADIO) $(CONF_XML) $(GENERATORS)/gen_radio.out $(Q)chmod a+r $@ $(Q)cp $< $(AIRCRAFT_CONF_DIR)/radios -$(PERIODIC_H) : $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF_XML) $(CONF)/$(TELEMETRY) $(MAKEFILE_AC) +$(PERIODIC_H) : $(MESSAGES_XML) $(CONF_XML) $(CONF)/$(TELEMETRY) $(MAKEFILE_AC) $(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED) @echo GENERATE $@ from $(TELEMETRY) $(eval $@_TMP := $(shell $(MKTEMP))) - $(Q)$(GENERATORS)/gen_periodic.out $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF)/$(TELEMETRY) $(TELEMETRY_FREQUENCY) $(SETTINGS_TELEMETRY) > $($@_TMP) + $(Q)$(GENERATORS)/gen_periodic.out $(MESSAGES_XML) $(CONF)/$(TELEMETRY) $(TELEMETRY_FREQUENCY) $(SETTINGS_TELEMETRY) > $($@_TMP) $(Q)mv $($@_TMP) $@ $(Q)chmod a+r $@ $(Q)cp $(CONF)/$(TELEMETRY) $(AIRCRAFT_CONF_DIR)/telemetry diff --git a/conf/telemetry/telemetry.dtd b/conf/telemetry/telemetry.dtd index 09389a37e0..b0abfa7a74 100644 --- a/conf/telemetry/telemetry.dtd +++ b/conf/telemetry/telemetry.dtd @@ -16,5 +16,4 @@ name CDATA #REQUIRED period CDATA #REQUIRED phase CDATA #IMPLIED - module CDATA #IMPLIED > diff --git a/sw/tools/generators/gen_periodic.ml b/sw/tools/generators/gen_periodic.ml index fcf20fead3..8069ad71a6 100644 --- a/sw/tools/generators/gen_periodic.ml +++ b/sw/tools/generators/gen_periodic.ml @@ -37,7 +37,7 @@ let lprintf = fun c f -> fprintf c "%s" (String.make !margin ' '); fprintf c f -let output_modes = fun out_h process_name telem_type modes freq modules -> +let output_modes = fun out_h process_name telem_type modes freq -> let min_period = 1./.float freq in let max_period = 65536. /. float freq in @@ -48,17 +48,13 @@ let output_modes = fun out_h process_name telem_type modes freq modules -> lprintf out_h "if (telemetry_mode_%s == TELEMETRY_MODE_%s_%s) {\n" process_name process_name mode_name; right (); - (** Filter message list to remove messages linked to unloaded modules *) - let filtered_msg = List.filter (fun msg -> - try let att = Xml.attrib msg "module" in List.exists (fun name -> String.compare name att = 0) modules with _ -> true - ) (Xml.children mode) in (** Computes the required modulos *) let messages = List.map (fun x -> let p = float_of_string (ExtXml.attrib x "period") in if p < min_period || p > max_period then fprintf stderr "Warning: period is bound between %.3fs and %.3fs for message %s\n%!" min_period max_period (ExtXml.attrib x "name"); (x, min 65535 (max 1 (int_of_float (p*.float_of_int freq)))) - ) filtered_msg in + ) (Xml.children mode) in let modulos = GC.singletonize (List.map snd messages) in List.iter (fun m -> let v = sprintf "i%d" m in @@ -175,7 +171,7 @@ let print_message_table = fun out_h xml -> fprintf out_h "}\n\n" ) telemetry_types -let print_process_send = fun out_h xml freq modules -> +let print_process_send = fun out_h xml freq -> (** For each process *) List.iter (fun process -> @@ -214,7 +210,7 @@ let print_process_send = fun out_h xml freq modules -> lprintf out_h "static inline void periodic_telemetry_send_%s(struct periodic_telemetry *telemetry, struct transport_tx *trans, struct link_device *dev) { /* %dHz */\n" process_name freq; right (); - output_modes out_h process_name telem_type modes freq modules; + output_modes out_h process_name telem_type modes freq; left (); lprintf out_h "}\n" ) @@ -223,23 +219,21 @@ let print_process_send = fun out_h xml freq modules -> let _ = - if Array.length Sys.argv <> 6 then begin - failwith (sprintf "Usage: %s frequency_in_hz out_settings_file" Sys.argv.(0)) + if Array.length Sys.argv <> 5 then begin + failwith (sprintf "Usage: %s frequency_in_hz out_settings_file" Sys.argv.(0)) end; - let freq = int_of_string(Sys.argv.(4)) in + let freq = int_of_string(Sys.argv.(3)) in let telemetry_xml = try - Xml.parse_file Sys.argv.(3) + Xml.parse_file Sys.argv.(2) with Dtd.Check_error e -> failwith (Dtd.check_error e) - in - let modules_name = GC.get_modules_name (ExtXml.parse_file Sys.argv.(1)) in let out_h = stdout in (** Print header *) - fprintf out_h "/* This file has been generated by gen_periodic from %s and %s */\n" Sys.argv.(2) Sys.argv.(3); + fprintf out_h "/* This file has been generated by gen_periodic from %s and %s */\n" Sys.argv.(1) Sys.argv.(2); fprintf out_h "/* Version %s */\n" (Env.get_paparazzi_version ()); fprintf out_h "/* Please DO NOT EDIT */\n\n"; fprintf out_h "#ifndef _VAR_PERIODIC_H_\n"; @@ -253,11 +247,11 @@ let _ = print_message_table out_h telemetry_xml; (** Print process sending functions *) - print_process_send out_h telemetry_xml freq modules_name; + print_process_send out_h telemetry_xml freq; (** Output XML settings file with telemetry modes *) - let out_set = open_out Sys.argv.(5) in - write_settings Sys.argv.(3) out_set telemetry_xml; + let out_set = open_out Sys.argv.(4) in + write_settings Sys.argv.(2) out_set telemetry_xml; close_out out_set; fprintf out_h "#endif // _VAR_PERIODIC_H_\n";