mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-28 01:53:48 +08:00
radio attribute is now optional in aircraft config
This commit is contained in:
+5
-1
@@ -65,7 +65,11 @@ init:
|
|||||||
demo:
|
demo:
|
||||||
$(SUPERVISION)
|
$(SUPERVISION)
|
||||||
|
|
||||||
all_ac_h: $(AIRFRAME_H) $(RADIO_H) $(FLIGHT_PLAN_H) $(FLIGHT_PLAN_XML) $(SETTINGS_H) $(TUNING_H) $(MAKEFILE_AC) $(PERIODIC_H) $(MODULES_H)
|
all_ac_h: $(AIRFRAME_H) $(SETTINGS_H) $(TUNING_H) $(MAKEFILE_AC) $(PERIODIC_H) $(MODULES_H)
|
||||||
|
|
||||||
|
radio_ac_h : $(RADIO_H)
|
||||||
|
|
||||||
|
flight_plan_ac_h : $(FLIGHT_PLAN_H) $(FLIGHT_PLAN_XML)
|
||||||
|
|
||||||
makefile_ac: $(MAKEFILE_AC)
|
makefile_ac: $(MAKEFILE_AC)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,9 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
|
#if defined RADIO_CONTROL || RADIO_CONTROL_AUTO1
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
#endif
|
||||||
#include "paparazzi.h"
|
#include "paparazzi.h"
|
||||||
#include "airframe.h"
|
#include "airframe.h"
|
||||||
#include "radio_control.h"
|
#include "radio_control.h"
|
||||||
|
|||||||
+16
-8
@@ -54,8 +54,7 @@ let gcs_icons_path = paparazzi_home // "data" // "pictures" // "gcs_icons"
|
|||||||
|
|
||||||
let expand_ac_xml = fun ac_conf ->
|
let expand_ac_xml = fun ac_conf ->
|
||||||
let prefix = fun s -> sprintf "%s/conf/%s" paparazzi_home s in
|
let prefix = fun s -> sprintf "%s/conf/%s" paparazzi_home s in
|
||||||
let parse = fun a ->
|
let parse_file = fun a file ->
|
||||||
let file = prefix (ExtXml.attrib ac_conf a) in
|
|
||||||
try
|
try
|
||||||
Xml.parse_file file
|
Xml.parse_file file
|
||||||
with
|
with
|
||||||
@@ -66,10 +65,19 @@ let expand_ac_xml = fun ac_conf ->
|
|||||||
let s = Xml.error e in
|
let s = Xml.error e in
|
||||||
prerr_endline (sprintf "Parse error in %s: %s" file s);
|
prerr_endline (sprintf "Parse error in %s: %s" file s);
|
||||||
make_element "cannot_parse" ["file",file;"error", s] [] in
|
make_element "cannot_parse" ["file",file;"error", s] [] in
|
||||||
let fp = parse "flight_plan"
|
|
||||||
and af = parse "airframe"
|
let parse = fun a ->
|
||||||
and rc = parse "radio"
|
let file = prefix (ExtXml.attrib ac_conf a) in
|
||||||
and st = parse "settings"
|
parse_file a file in
|
||||||
and tm = parse "telemetry" in
|
|
||||||
let children = Xml.children ac_conf@[fp; af; rc; st; tm] in
|
let parse_opt = fun a others ->
|
||||||
|
try
|
||||||
|
parse a :: others
|
||||||
|
with
|
||||||
|
ExtXml.Error _ -> others in
|
||||||
|
|
||||||
|
let pervasives = [parse "airframe"; parse "settings"; parse "telemetry"] in
|
||||||
|
let optionals = parse_opt "radio" (parse_opt "flight_plan" pervasives) in
|
||||||
|
|
||||||
|
let children = Xml.children ac_conf@optionals in
|
||||||
make_element (Xml.tag ac_conf) (Xml.attribs ac_conf) children
|
make_element (Xml.tag ac_conf) (Xml.attribs ac_conf) children
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Call to Makefile.ac with the appropriate attributes from conf.xml
|
* Call to Makefile.ac with the appropriate attributes from conf.xml
|
||||||
*
|
*
|
||||||
* Copyright (C) 2003-2008 Pascal Brisset, Antoine Drouin, ENAC
|
* Copyright (C) 2003-2009 Pascal Brisset, Antoine Drouin, ENAC
|
||||||
*
|
*
|
||||||
* This file is part of paparazzi.
|
* This file is part of paparazzi.
|
||||||
*
|
*
|
||||||
@@ -36,7 +36,8 @@ let mkdir = fun d ->
|
|||||||
Unix.mkdir d 0o755
|
Unix.mkdir d 0o755
|
||||||
|
|
||||||
let check_unique_id = fun conf ->
|
let check_unique_id = fun conf ->
|
||||||
let ids = Hashtbl.create 5 in
|
let ids = Hashtbl.create 5
|
||||||
|
and names = Hashtbl.create 5 in
|
||||||
List.iter
|
List.iter
|
||||||
(fun x ->
|
(fun x ->
|
||||||
if String.lowercase (Xml.tag x) = "aircraft" then
|
if String.lowercase (Xml.tag x) = "aircraft" then
|
||||||
@@ -46,10 +47,17 @@ let check_unique_id = fun conf ->
|
|||||||
let other_name = Hashtbl.find ids id in
|
let other_name = Hashtbl.find ids id in
|
||||||
failwith (sprintf "Error: A/C Id '%s' duplicated in %s (%s and %s)" id conf_xml name other_name)
|
failwith (sprintf "Error: A/C Id '%s' duplicated in %s (%s and %s)" id conf_xml name other_name)
|
||||||
end;
|
end;
|
||||||
Hashtbl.add ids id name)
|
if Hashtbl.mem names name then begin
|
||||||
|
let other_id = Hashtbl.find names name in
|
||||||
|
failwith (sprintf "Error: A/C name '%s' duplicated in %s (ids %s and %s)" name conf_xml id other_id)
|
||||||
|
end;
|
||||||
|
Hashtbl.add ids id name;
|
||||||
|
Hashtbl.add names name id)
|
||||||
(Xml.children conf)
|
(Xml.children conf)
|
||||||
|
|
||||||
let _ =
|
|
||||||
|
|
||||||
|
let () =
|
||||||
if Array.length Sys.argv <> 2 then
|
if Array.length Sys.argv <> 2 then
|
||||||
failwith (sprintf "Usage: %s <A/C ident (conf.xml)>" Sys.argv.(0));
|
failwith (sprintf "Usage: %s <A/C ident (conf.xml)>" Sys.argv.(0));
|
||||||
let aircraft = Sys.argv.(1) in
|
let aircraft = Sys.argv.(1) in
|
||||||
@@ -97,8 +105,8 @@ let _ =
|
|||||||
Printf.fprintf f "%s\n" md5sum;
|
Printf.fprintf f "%s\n" md5sum;
|
||||||
close_out f;
|
close_out f;
|
||||||
|
|
||||||
let make = fun target ->
|
let make = fun target options ->
|
||||||
let c = sprintf "make -f Makefile.ac AIRCRAFT=%s AC_ID=%s AIRFRAME_XML=%s RADIO=%s FLIGHT_PLAN=%s TELEMETRY=%s SETTINGS=\"%s\" MD5SUM=\"%s\" %s" aircraft (value "ac_id") (value "airframe") (value "radio") (value "flight_plan") (value "telemetry") settings md5sum target in
|
let c = sprintf "make -f Makefile.ac AIRCRAFT=%s AC_ID=%s AIRFRAME_XML=%s TELEMETRY=%s SETTINGS=\"%s\" MD5SUM=\"%s\" %s %s" aircraft (value "ac_id") (value "airframe") (value "telemetry") settings md5sum options target in
|
||||||
prerr_endline c;
|
prerr_endline c;
|
||||||
begin (** Quiet is speficied in the Makefile *)
|
begin (** Quiet is speficied in the Makefile *)
|
||||||
try if Sys.getenv "Q" <> "@" then raise Not_found with
|
try if Sys.getenv "Q" <> "@" then raise Not_found with
|
||||||
@@ -107,5 +115,15 @@ let _ =
|
|||||||
let returned_code = Sys.command c in
|
let returned_code = Sys.command c in
|
||||||
if returned_code <> 0 then
|
if returned_code <> 0 then
|
||||||
exit returned_code in
|
exit returned_code in
|
||||||
make "makefile_ac";
|
|
||||||
make "all_ac_h"
|
let make_opt = fun target var attr ->
|
||||||
|
try
|
||||||
|
let value = Xml.attrib aircraft_xml attr in
|
||||||
|
make target (sprintf "%s=%s" var value)
|
||||||
|
with
|
||||||
|
Xml.No_attribute _ -> () in
|
||||||
|
|
||||||
|
make "makefile_ac" "";
|
||||||
|
make "all_ac_h" "";
|
||||||
|
make_opt "radio_ac_h" "RADIO" "radio";
|
||||||
|
make_opt "flight_plan_ac_h" "FLIGHT_PLAN" "flight_plan"
|
||||||
|
|||||||
Reference in New Issue
Block a user