diff --git a/conf/airframes/twinstar1.xml b/conf/airframes/twinstar1.xml
index 1095b52a6e..a3d205a108 100644
--- a/conf/airframes/twinstar1.xml
+++ b/conf/airframes/twinstar1.xml
@@ -83,4 +83,8 @@
+
+LOCAL_CFLAGS += -DWAVECARD_ON_UART0
+$(TARGET).srcs += wavecard.c
+
diff --git a/sw/airborne/autopilot/Makefile b/sw/airborne/autopilot/Makefile
index 9b5b6f5eb8..25f787ded5 100644
--- a/sw/airborne/autopilot/Makefile
+++ b/sw/airborne/autopilot/Makefile
@@ -1,6 +1,6 @@
#
# $Id$
-# Copyright (C) 2003 Pascal Brisset, Antoine Drouin
+# Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin
#
# This file is part of paparazzi.
#
@@ -24,7 +24,7 @@
FBW=../fly_by_wire
-LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS) -DWAVECARD_ON_UART0
+LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS)
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
@@ -63,8 +63,7 @@ $(TARGET).srcs = \
mainloop.c \
cam.c \
traffic_info.c \
- datalink.c \
- wavecard.c
+ datalink.c
ifeq ($(AIRCRAFT), Gorazoptere_brushless_ANALOG)
$(TARGET).srcs += ahrs.S
@@ -77,6 +76,7 @@ ifeq ($(AIRCRAFT), quadRotorJP)
endif
+include $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/Makefile.ac
include ../../../conf/Makefile.local
include ../../../conf/Makefile.avr
diff --git a/sw/airborne/autopilot/mainloop.c b/sw/airborne/autopilot/mainloop.c
index f8bf4a1dfa..5b8ab5542b 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 || WAVECARD_ON_UART0
+#if defined SECTION_IMU_3DMG || defined SECTION_IMU_ANALOG || WAVECARD
uart0_init();
#endif //SECTION_IMU
/** - start interrupt task */
@@ -114,10 +114,12 @@ int main( void ) {
gps_pos_available = FALSE;
}
}
+#ifdef WAVECARD
if (wc_msg_received) {
wc_parse_payload();
wc_msg_received = FALSE;
}
+#endif
if (dl_msg_available) {
dl_parse_msg();
dl_msg_available = FALSE;
diff --git a/sw/airborne/autopilot/uart.c b/sw/airborne/autopilot/uart.c
index a568b5e4fa..cc72c2c5d6 100644
--- a/sw/airborne/autopilot/uart.c
+++ b/sw/airborne/autopilot/uart.c
@@ -121,7 +121,7 @@ SIGNAL(SIG_UART1_TRANS) {
void uart0_init( void ) {
/* Baudrate is 38.4k */
UBRR0H = 0;
-#ifdef WAVECARD_ON_UART0
+#ifdef WAVECARD
UBRR0L = 103; //9600
#else
UBRR0L = 25; // 38.4
@@ -133,7 +133,7 @@ void uart0_init( void ) {
UCSR0B = _BV(RXEN) | _BV(TXEN);
/* Set frame format: 8data, 1stop bit */
UCSR0C = _BV(UCSZ1) | _BV(UCSZ0);
-#ifdef WAVECARD_ON_UART0
+#ifdef WAVECARD
/* Enable uart receive interrupt */
sbi(UCSR0B, RXCIE );
#endif
diff --git a/sw/tools/extract_makefile.ml b/sw/tools/extract_makefile.ml
new file mode 100644
index 0000000000..d08fb24362
--- /dev/null
+++ b/sw/tools/extract_makefile.ml
@@ -0,0 +1,14 @@
+open Printf
+
+let _ =
+ let f = Sys.argv.(1) in
+ let xml = Xml.parse_file f in
+ printf "# This file has been generated from %s\n" f;
+ printf "# Please DO NOT EDIT\n";
+ try
+ match Xml.children (ExtXml.child xml "makefile") with
+ [Xml.PCData s] ->
+ printf "%s\n" s
+ | _ -> ()
+ with
+ _ -> ()
diff --git a/sw/tools/gen_airframe.ml b/sw/tools/gen_airframe.ml
index 7beb81c7b4..a8ece6c12e 100644
--- a/sw/tools/gen_airframe.ml
+++ b/sw/tools/gen_airframe.ml
@@ -102,6 +102,7 @@ let parse_command = fun command ->
printf " int16_t _var_%s = %s;\\\n" var v
| _ -> xml_error "set|let"
+
let parse_section = fun s ->
match Xml.tag s with
"section" ->
@@ -140,6 +141,9 @@ let parse_section = fun s ->
printf " uint16_t servo_value;\\\n";
List.iter parse_command (Xml.children s);
printf "}\n"
+ | "makefile" ->
+ ()
+ (** Ignoring this section *)
| _ -> xml_error "param|servos|command"