diff --git a/Makefile.ac b/Makefile.ac index f81cb227d3..022bcc6ba9 100644 --- a/Makefile.ac +++ b/Makefile.ac @@ -34,7 +34,7 @@ all: $(AIRFRAME_H) $(RADIO_H) $(FLIGHT_PLAN_H) $(INFLIGHT_CALIB_H) echo $(AIRFRAME_H) $(CONF)/$(AIRFRAME) $(AIRFRAME_H) : $(CONF)/$(AIRFRAME) $(CONF_XML) - $(TOOLS)/gen_airframe.out $(AIRCRAFT) $< > /tmp/airframe.h + $(TOOLS)/gen_airframe.out $(AC_ID) $(AIRCRAFT) $< > /tmp/airframe.h mv /tmp/airframe.h $@ $(RADIO_H) : $(CONF)/$(RADIO) $(CONF_XML) diff --git a/Makefile.gen b/Makefile.gen index 1446185e49..514e25f85e 100644 --- a/Makefile.gen +++ b/Makefile.gen @@ -38,9 +38,7 @@ static: $(MESSAGES_H) $(UBX_PROTOCOL_H) $(FBW_MESSAGES_H) $(MESSAGES_H) : $(MESSAGES_XML) $(CONF_XML) test -d $(STATICINCLUDE) || mkdir -p $(STATICINCLUDE) - TMP_FILE=`mktemp`;\ - $(TOOLS)/gen_messages.out $< telemetry_ap > $$TMP_FILE;\ - mv $$TMP_FILE $@ + $(TOOLS)/gen_messages.out $< telemetry_ap > $@ chmod a+r $@ $(FBW_MESSAGES_H) : $(MESSAGES_XML) $(CONF_XML) diff --git a/conf/messages.xml b/conf/messages.xml index 296f760a29..c367f09ec4 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -138,7 +138,7 @@ - + diff --git a/sw/airborne/autopilot/main.c b/sw/airborne/autopilot/main.c index ece024e35d..49f8f1e7ab 100644 --- a/sw/airborne/autopilot/main.c +++ b/sw/airborne/autopilot/main.c @@ -183,7 +183,7 @@ uint8_t ticks_last_est; // 20Hz #define INIT_MSG_NB 2 #define HI_FREQ_PHASE_NB 5 -static char ac_ident[16] = AIRFRAME_NAME; +uint8_t ac_ident = AC_ID; #define PERIODIC_SEND_BAT() DOWNLINK_SEND_BAT(&vsupply, &estimator_flight_time, &low_battery, &block_time, &stage_time) #define PERIODIC_SEND_DEBUG() DOWNLINK_SEND_DEBUG(&link_fbw_nb_err, &link_fbw_fbw_nb_err, &modem_nb_ovrn, &gps_nb_ovrn, &mcu1_ppm_cpt); @@ -195,7 +195,7 @@ static char ac_ident[16] = AIRFRAME_NAME; #define PERIODIC_SEND_DESIRED() DOWNLINK_SEND_DESIRED(&desired_roll, &desired_pitch, &desired_x, &desired_y, &desired_altitude); #define PERIODIC_SEND_PITCH() DOWNLINK_SEND_PITCH(&ir_pitch, &ir_pitch_neutral, &ir_gain); #define PERIODIC_SEND_NAVIGATION_REF() DOWNLINK_SEND_NAVIGATION_REF(&utm_east0, &utm_north0); -#define PERIODIC_SEND_IDENT() DOWNLINK_SEND_IDENT(ac_ident); +#define PERIODIC_SEND_IDENT() DOWNLINK_SEND_IDENT(&ac_ident); #ifdef RADIO_CALIB #define PERIODIC_SEND_SETTINGS() if (inflight_calib_mode != IF_CALIB_MODE_NONE) DOWNLINK_SEND_SETTINGS(&inflight_calib_mode, &slider_1_val, &slider_2_val); diff --git a/sw/ground_segment/tmtc/receive.ml b/sw/ground_segment/tmtc/receive.ml index 455daf50f7..4df9693212 100644 --- a/sw/ground_segment/tmtc/receive.ml +++ b/sw/ground_segment/tmtc/receive.ml @@ -230,7 +230,7 @@ let send_traffic_info = fun ac -> (* Sending on the Ivy bus for the simulators *) let a = Hashtbl.find aircrafts ac in let f = fun x -> Pprz.Float x in - let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "name" = ac) in + let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "ac_id" = ac) in let values = ["ac_id", Pprz.Int (int_of_string (ExtXml.attrib conf "ac_id")); "east", f a.east; "north", f a.north; @@ -266,7 +266,7 @@ let listen_sims = fun log -> (* Server on the Ivy bus *) let send_flight_plan = fun id -> try - let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "name" = id) in + let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "ac_id" = id) in let f = ExtXml.attrib conf "flight_plan" in Ivy.send (sprintf "ground FLIGHT_PLAN %s file://%s/conf/%s" id Env.paparazzi_home f) with @@ -276,7 +276,7 @@ let send_flight_plan = fun id -> let send_config = fun id_ac id_req -> try prerr_endline (sprintf "[%s] [%s]\n" id_ac id_req); - let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "name" = id_ac) in + let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "ac_id" = id_ac) in let fp = sprintf "%s/conf/%s" Env.paparazzi_home (ExtXml.attrib conf "flight_plan") and af = sprintf "%s/conf/%s" Env.paparazzi_home (ExtXml.attrib conf "airframe") and rc = sprintf "%s/conf/%s" Env.paparazzi_home (ExtXml.attrib conf "radio")in @@ -306,29 +306,6 @@ let handle_pprz_message = fun log a -> | Some ac_name -> log_and_parse log ac_name a msg values -module Coronis = struct - let send_ack = fun delay fd -> - ignore (GMain.Timeout.add delay (fun _ -> Wavecard.send fd ("ACK", ""); false)) - - let broadcast_msg = fun (msg, data) -> - Ivy.send (sprintf "FROM_WAVECARD %s %s" msg data) - - let connect = fun port -> - try - let fd = Serial.opendev port Serial.B9600 in - (* Listening *) - let cb = fun _ -> - Wavecard.receive ~ack:(fun () -> send_ack 100 fd) broadcast_msg fd; - true in - ignore (GMain.Io.add_watch [`IN] cb (GMain.Io.channel_of_descr fd)); - - (* Sending request from Ivy *) - let send = fun _ a -> Wavecard.send fd (a.(0), a.(1)) in - ignore (Ivy.bind send "TO_WAVECARD +([^ ]+) +([^ ]+)") - with - _ -> failwith "Coronis.connect" -end - let listen_link = fun log xml_link -> match ExtXml.attrib xml_link "protocol" with "pprz/modem" -> @@ -336,11 +313,6 @@ let listen_link = fun log xml_link -> let port = ExtXml.attrib xml_link "port" in let ac = new_aircraft (Modem port) in listen_pprz_modem (handle_pprz_message log ac) port -(*** - | "pprz/coronis" -> - let port = ExtXml.attrib xml_link "port" in - Coronis.connect port -***) | _ -> fprintf stderr "Warning: Ignoring link '%s'\n" (ExtXml.attrib xml_link "name") diff --git a/sw/tools/gen_aircraft.ml b/sw/tools/gen_aircraft.ml index b48e0b13a5..b49a25d183 100644 --- a/sw/tools/gen_aircraft.ml +++ b/sw/tools/gen_aircraft.ml @@ -30,6 +30,6 @@ let _ = mkdir (aircraft_dir // "autopilot"); mkdir (aircraft_dir // "sim"); - let c = sprintf "make -f Makefile.ac AIRCRAFT=%s AIRFRAME=%s RADIO=%s FLIGHT_PLAN=%s" aircraft (value "airframe") (value "radio") (value "flight_plan") in + let c = sprintf "make -f Makefile.ac AIRCRAFT=%s AC_ID=%s AIRFRAME=%s RADIO=%s FLIGHT_PLAN=%s" aircraft (value "ac_id") (value "airframe") (value "radio") (value "flight_plan") in prerr_endline c; exit (Sys.command c) diff --git a/sw/tools/gen_airframe.ml b/sw/tools/gen_airframe.ml index 9b565c39cc..f0c188565f 100644 --- a/sw/tools/gen_airframe.ml +++ b/sw/tools/gen_airframe.ml @@ -138,14 +138,16 @@ let parse_section = fun s -> let h_name = "AIRFRAME_H" let _ = - if Array.length Sys.argv <> 3 then - failwith (Printf.sprintf "Usage: %s A/C_ident xml_file" Sys.argv.(0)); - let xml_file = Sys.argv.(2) - and ac_name = Sys.argv.(1) in + if Array.length Sys.argv <> 4 then + failwith (Printf.sprintf "Usage: %s A/C_ident A/C_name xml_file" Sys.argv.(0)); + let xml_file = Sys.argv.(3) + and ac_id = Sys.argv.(1) + and ac_name = Sys.argv.(2) in try let xml = start_and_begin xml_file h_name in Xml2h.warning ("AIRFRAME MODEL: "^ ac_name); define_string "AIRFRAME_NAME" ac_name; + define "AC_ID" ac_id; nl (); let v = ExtXml.attrib xml "ctl_board" in define ("CTL_BRD_"^v) "1";