diff --git a/conf/messages.xml b/conf/messages.xml
index e4c438c190..ace1f7a265 100644
--- a/conf/messages.xml
+++ b/conf/messages.xml
@@ -191,6 +191,14 @@
+
+
+
+
+
+
+
+
diff --git a/sw/airborne/autopilot/Makefile b/sw/airborne/autopilot/Makefile
index 9c3eaeb211..9b5b6f5eb8 100644
--- a/sw/airborne/autopilot/Makefile
+++ b/sw/airborne/autopilot/Makefile
@@ -24,7 +24,7 @@
FBW=../fly_by_wire
-LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS) -DWAVECARD_ON_GPS
+LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS) -DWAVECARD_ON_UART0
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
diff --git a/sw/airborne/autopilot/datalink.c b/sw/airborne/autopilot/datalink.c
index 0734174d86..02f6011506 100644
--- a/sw/airborne/autopilot/datalink.c
+++ b/sw/airborne/autopilot/datalink.c
@@ -35,6 +35,9 @@
#include "flight_plan.h"
#include "autopilot.h"
+/***/
+#include "uart.h"
+
#define MOfCm(_x) (((float)_x)/100.)
@@ -63,11 +66,3 @@ void dl_parse_msg(void) {
}
}
}
-
-/* #include "uart.h" */
-/* void dl_parse_msg(void) { */
-/* dl_buffer[6] = '\0'; */
-/* uart0_print_string(dl_buffer); */
-/* uart0_transmit('\n'); */
-/* } */
-
diff --git a/sw/airborne/autopilot/main.c b/sw/airborne/autopilot/main.c
index 6c703891da..a8263f2202 100644
--- a/sw/airborne/autopilot/main.c
+++ b/sw/airborne/autopilot/main.c
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * Copyright (C) 2003 Pascal Brisset, Antoine Drouin
+ * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin
*
* This file is part of paparazzi.
*
@@ -42,6 +42,7 @@
#include "estimator.h"
#include "if_calib.h"
#include "cam.h"
+#include "traffic_info.h"
#ifdef SECTION_IMU_ANALOG
#include "ahrs.h"
@@ -242,6 +243,8 @@ uint8_t ac_ident = AC_ID;
#define PERIODIC_SEND_NAVIGATION_REF() DOWNLINK_SEND_NAVIGATION_REF(&nav_utm_east0, &nav_utm_north0, &nav_utm_zone0);
+#define PERIODIC_SEND_ACINFO() { struct ac_info_ *s=get_ac_info(1); DOWNLINK_SEND_ACINFO(&s->east, &s->north, &s->course, &s->alt, &s->gspeed); }
+
#ifdef RADIO_CALIB
#define PERIODIC_SEND_SETTINGS() if (inflight_calib_mode != IF_CALIB_MODE_NONE) DOWNLINK_SEND_SETTINGS(&slider_1_val, &slider_2_val);
#else
diff --git a/sw/airborne/autopilot/mainloop.c b/sw/airborne/autopilot/mainloop.c
index bbda2d2504..f8bf4a1dfa 100644
--- a/sw/airborne/autopilot/mainloop.c
+++ b/sw/airborne/autopilot/mainloop.c
@@ -72,7 +72,7 @@ int main( void ) {
nav_init();
ir_init();
estimator_init();
-#if defined SECTION_IMU_3DMG || defined SECTION_IMU_ANALOG
+#if defined SECTION_IMU_3DMG || defined SECTION_IMU_ANALOG || WAVECARD_ON_UART0
uart0_init();
#endif //SECTION_IMU
/** - start interrupt task */
diff --git a/sw/airborne/autopilot/uart.c b/sw/airborne/autopilot/uart.c
index 17b54f2e2d..a568b5e4fa 100644
--- a/sw/airborne/autopilot/uart.c
+++ b/sw/airborne/autopilot/uart.c
@@ -121,8 +121,11 @@ SIGNAL(SIG_UART1_TRANS) {
void uart0_init( void ) {
/* Baudrate is 38.4k */
UBRR0H = 0;
- // UBRR0L = 103; //9600
+#ifdef WAVECARD_ON_UART0
+ UBRR0L = 103; //9600
+#else
UBRR0L = 25; // 38.4
+#endif
/* single speed */
UCSR0A = 0;
@@ -130,8 +133,10 @@ void uart0_init( void ) {
UCSR0B = _BV(RXEN) | _BV(TXEN);
/* Set frame format: 8data, 1stop bit */
UCSR0C = _BV(UCSZ1) | _BV(UCSZ0);
+#ifdef WAVECARD_ON_UART0
/* Enable uart receive interrupt */
- // sbi(UCSR0B, RXCIE );
+ sbi(UCSR0B, RXCIE );
+#endif
}
void uart1_init( void ) {
diff --git a/sw/airborne/autopilot/wavecard.h b/sw/airborne/autopilot/wavecard.h
index c3bc5d44dc..38296dfed1 100644
--- a/sw/airborne/autopilot/wavecard.h
+++ b/sw/airborne/autopilot/wavecard.h
@@ -44,7 +44,7 @@
extern uint8_t wc_msg_received;
extern uint8_t wc_length;
-void parse_payload(void);
+void wc_parse_payload(void);
diff --git a/sw/ground_segment/tmtc/wavecard_connect.ml b/sw/ground_segment/tmtc/wavecard_connect.ml
index 41b3c8257b..5458909f37 100644
--- a/sw/ground_segment/tmtc/wavecard_connect.ml
+++ b/sw/ground_segment/tmtc/wavecard_connect.ml
@@ -34,16 +34,18 @@ type aircraft = { fd : Unix.file_descr; id : int; addr : W.addr }
let send_ack = fun delay fd () ->
ignore (GMain.Timeout.add delay (fun _ -> W.send fd (W.ACK, ""); false))
-let send = fun ac a ->
+let send = fun ac s ->
+ Wavecard.send_addressed ac.fd (W.REQ_SEND_MESSAGE,ac.addr,s)
+
+let send_dl_msg = fun ac a ->
let (id, values) = Dl_Pprz.values_of_string a in
let s = Dl_Pprz.payload_of_values id values in
- Wavecard.send_addressed ac.fd (W.REQ_SEND_MESSAGE,ac.addr,s)
+ send ac s
let broadcast_msg = fun (com, data) ->
- prerr_endline "bc";
match com with
W.RECEIVED_FRAME ->
Ivy.send (sprintf "FROM_WAVECARD %s" data)
@@ -77,6 +79,7 @@ let get_fp = fun ac _sender vs ->
(** Got a MOVE_WAYPOINT and send a MOVE_WP *)
let move_wp = fun ac _sender vs ->
+ prerr_endline "move";
let ac_id = int_of_string (Pprz.string_assoc "ac_id" vs) in
if ac_id = ac.id then
let f = fun a -> Pprz.float_assoc a vs in
@@ -88,6 +91,7 @@ let move_wp = fun ac _sender vs ->
"utm_east", cm_of_m ux;
"utm_north", cm_of_m uy;
"alt", cm_of_m alt] in
+ prerr_endline "move";
let msg_id, _ = Dl_Pprz.message_of_name "MOVE_WP" in
let s = Dl_Pprz.payload_of_values msg_id vs in
send ac s
@@ -127,7 +131,7 @@ let _ =
(* Sending request from Ivy *)
(* For debug *)
- ignore (Ivy.bind (fun _ a -> send ac a.(0)) "TO_WAVECARD +(.*)");
+ ignore (Ivy.bind (fun _ a -> send_dl_msg ac a.(0)) "TO_WAVECARD +(.*)");
ignore (Ground_Pprz.message_bind "FLIGHT_PARAM" (get_fp ac));
ignore (Ground_Pprz.message_bind "MOVE_WAYPOINT" (move_wp ac));