diff --git a/Makefile b/Makefile index 27d6a2c9e1..194889d8c7 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,6 @@ include conf/Makefile.local LIB=sw/lib AIRBORNE=sw/airborne CONFIGURATOR=sw/configurator -FBW=$(AIRBORNE)/fly_by_wire -AP=$(AIRBORNE)/autopilot COCKPIT=sw/ground_segment/cockpit TMTC=sw/ground_segment/tmtc MULTIMON=sw/ground_segment/multimon @@ -74,23 +72,23 @@ sim_static : sim_sitl : cd $(SIMULATOR); $(MAKE) sim_sitl PAPARAZZI_HOME=$(PAPARAZZI_SRC) PAPARAZZI_SRC=$(PAPARAZZI_SRC) AIRCRAFT=$(AIRCRAFT) -fbw fly_by_wire: - cd $(FBW); $(MAKE) all +fbw fly_by_wire: ac_h + cd $(AIRBORNE); $(MAKE) TARGET=fbw all -ap autopilot: - cd $(AP); $(MAKE) all +ap autopilot: ac_h + cd $(AIRBORNE); $(MAKE) TARGET=ap all upload_fbw: hard_ac - cd $(FBW); $(MAKE) upload + cd $(AIRBORNE); $(MAKE) TARGET=fbw upload upload_ap: hard_ac - cd $(AP); $(MAKE) upload + cd $(AIRBORNE); $(MAKE) TARGET=ap upload erase_fbw: - cd $(FBW); $(MAKE) erase + cd $(AIRBORNE); $(MAKE) TARGET=fbw erase erase_ap: - cd $(AP); $(MAKE) erase + cd $(AIRBORNE); $(MAKE) TARGET=ap erase airborne: fbw ap diff --git a/conf/Makefile.avr b/conf/Makefile.avr index 5b3a42d2a3..4c0d5f7fad 100644 --- a/conf/Makefile.avr +++ b/conf/Makefile.avr @@ -26,10 +26,10 @@ # Edit the configuration part to suit your local install # -OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGETDIR) +OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGET) SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/avr -CC = $(ATMELBIN)/avr-gcc -mmcu=$(ARCH) +CC = $(ATMELBIN)/avr-gcc -mmcu=$($(TARGET).ARCH) LD = $(CC) $(ATMEL_LIBPATH) SIZE = $(ATMELBIN)/avr-size OBJCOPY = $(ATMELBIN)/avr-objcopy @@ -60,7 +60,8 @@ CFLAGS = \ $(INCLUDES) \ -Wall \ -Wstrict-prototypes \ - $(LOCAL_CFLAGS) \ + $($(TARGET).CFLAGS) \ + $(LOCAL_CFLAGS) \ -O2 \ LDFLAGS = -lm \ @@ -70,10 +71,15 @@ LDFLAGS = -lm \ # $(TARGET).srcsnd = $(notdir $($(TARGET).srcs)) -$(TARGET).objs = $($(TARGET).srcsnd:%.c=$(OBJDIR)/%.o) +$(TARGET).objso = $($(TARGET).srcsnd:%.c=$(OBJDIR)/%.o) +$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o) all compile: $($(TARGET).objs) $(OBJDIR)/$(TARGET).elf +#all: +# @echo !!!!!!! +# @echo $($(TARGET).objs) +# @echo !!!!!!! load upload: $(TARGET).install @@ -121,6 +127,9 @@ $(OBJDIR)/%.o: %.c $(OBJDIR)/%.o: $(SRC_ARCH)/%.c $(CC) $(CFLAGS) -c -o $@ $< +$(OBJDIR)/%.o: $(SRC_ARCH)/%.S + $(CC) $(CFLAGS) -c -o $@ $< + $(OBJDIR)/%.hex: $(OBJDIR)/%.elf $(OBJCOPY) -O ihex -R .eeprom $< $@ @@ -134,7 +143,7 @@ erase: check_arch $(UISP) $(ISP_FLAGS) --erase check_arch : - if ($(UISP) $(UISP_FLAGS) 2>&1 | tr '[:upper:]' '[:lower:]' | grep $(ARCH)); then : ; else echo "Wrong architecture (mcu0 vs mcu1 ?)"; exit 1; fi + if ($(UISP) $(UISP_FLAGS) 2>&1 | tr '[:upper:]' '[:lower:]' | grep $($(TARGET).ARCH)); then : ; else echo "Wrong architecture (mcu0 vs mcu1 ?)"; exit 1; fi avr_clean: rm -rf $(OBJDIR) diff --git a/conf/airframes/flyingtux.xml b/conf/airframes/flyingtux.xml index bf3c06ecea..b58ead0633 100644 --- a/conf/airframes/flyingtux.xml +++ b/conf/airframes/flyingtux.xml @@ -1,4 +1,4 @@ - +
@@ -90,8 +90,9 @@
+ +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2.makefile + +ap.CFLAGS += -DUBX +
- - - - diff --git a/conf/airframes/gorazoptere_brushless_3DMG.xml b/conf/airframes/gorazoptere_brushless_3DMG.xml deleted file mode 100644 index 31b3eb6c42..0000000000 --- a/conf/airframes/gorazoptere_brushless_3DMG.xml +++ /dev/null @@ -1,82 +0,0 @@ - -
-
-
- - - - - - - - - -
-
- - - -
-
- - -
- - - - - - - - - - - - - - - - -
- - - - - - -
-
- - - - - - -
-
- - - - - - - - -
-
- - - -
-
- - - - - -
-
- - -
-
diff --git a/conf/airframes/gorazoptere_brushless_ANALOG.xml b/conf/airframes/gorazoptere_brushless_ANALOG.xml index a52c37a659..6587c36d84 100644 --- a/conf/airframes/gorazoptere_brushless_ANALOG.xml +++ b/conf/airframes/gorazoptere_brushless_ANALOG.xml @@ -1,4 +1,4 @@ - +
@@ -114,12 +114,18 @@
-LOCAL_CFLAGS += -DTELEMETER -AP_EXTRA_SRCS += i2c_ap.c srf08.c -LOCAL_CFLAGS += -DRATE_LOOP -DIMU_ANALOG -FBW_EXTRA_SRCS += control.c imu.c -LOCAL_CFLAGS += -DAHRS -AP_EXTRA_SRCS += ahrs.S ahrs.c -LOCAL_CFLAGS += -DIMU_RESET_ON_BOOT +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile + +LOCAL_CFLAGS += -DIMU_ANALOG + +fbw.CFLAGS += -DRATE_LOOP +fbw.EXTRA_SRCS += control.c imu.c +fbw.CFLAGS += -DIMU_RESET_ON_BOOT + +ap.CFLAGS += -DUBX +ap.CFLAGS += -DTELEMETER +ap.EXTRA_SRCS += $(SRC_ARCH)/i2c_ap.c srf08.c +ap.CFLAGS += -DAHRS +ap.EXTRA_SRCS += $(SRC_ARCH)/ahrs_asm.S ahrs.c
diff --git a/conf/airframes/ladybug.xml b/conf/airframes/ladybug.xml index b28d1fbc0c..6bbac440a3 100755 --- a/conf/airframes/ladybug.xml +++ b/conf/airframes/ladybug.xml @@ -1,5 +1,5 @@ - +
@@ -90,8 +90,9 @@
+ +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2.makefile + +ap.CFLAGS += -DUBX +
- - - - diff --git a/conf/airframes/microjet1.xml b/conf/airframes/microjet1.xml index 430db4cfb9..70e97a0d30 100644 --- a/conf/airframes/microjet1.xml +++ b/conf/airframes/microjet1.xml @@ -1,4 +1,4 @@ - +
@@ -79,4 +79,9 @@
+ +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2.makefile + +ap.CFLAGS += -DUBX +
diff --git a/conf/airframes/microjet2.xml b/conf/airframes/microjet2.xml deleted file mode 100644 index 07b3bf9a54..0000000000 --- a/conf/airframes/microjet2.xml +++ /dev/null @@ -1,73 +0,0 @@ - -
- - -
- - - - - - - - - - - - -
- - -
-
- - - - - - -
-
- - - - - - -
-
- - - - - - -
-
- - - -
-
- - - - -
-
- - - -
-
- - -
-
- - - - - -
-
diff --git a/conf/airframes/microjet3.xml b/conf/airframes/microjet3.xml deleted file mode 100644 index 6f23e01af4..0000000000 --- a/conf/airframes/microjet3.xml +++ /dev/null @@ -1,97 +0,0 @@ - -
- - -
- - - - - - - - - - - - -
- - -
-
- - - - - - - - -
-
- - - - - - -
-
- - - - - - - - -
-
- - - -
-
- - - - -
-
- - - -
-
- - -
-
- - -
- -
- - - -
-
- - - - - -
-
- - -
-
diff --git a/conf/airframes/plaster1.xml b/conf/airframes/plaster1.xml index bbb245a324..4636116bbe 100755 --- a/conf/airframes/plaster1.xml +++ b/conf/airframes/plaster1.xml @@ -1,6 +1,6 @@ - +
@@ -91,4 +91,9 @@
+ +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile + +ap.CFLAGS += -DUBX +
diff --git a/conf/airframes/twinstar1.xml b/conf/airframes/twinstar1.xml index 269610a4a7..72738fc9d2 100644 --- a/conf/airframes/twinstar1.xml +++ b/conf/airframes/twinstar1.xml @@ -1,4 +1,4 @@ - +
@@ -87,10 +87,13 @@ -ARCHDIR=avr -LOCAL_CFLAGS += -DDATALINK -AP_EXTRA_SRCS += traffic_info.c datalink.c -LOCAL_CFLAGS += -DWAVECARD -AP_EXTRA_SRCS += wavecard.c +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile + +ap.CFLAGS += -DUBX +# ap.CFLAGS += -DSIMUL +ap.LOCAL_CFLAGS += -DDATALINK +ap.EXTRA_SRCS += traffic_info.c datalink.c +ap.LOCAL_CFLAGS += -DWAVECARD +ap.EXTRA_SRCS += wavecard.c
diff --git a/conf/airframes/twinstar2.xml b/conf/airframes/twinstar2.xml index b0290a2a75..58a3ae7917 100644 --- a/conf/airframes/twinstar2.xml +++ b/conf/airframes/twinstar2.xml @@ -1,4 +1,4 @@ - +
@@ -84,8 +84,12 @@
-LOCAL_CFLAGS += -DDATALINK -AP_EXTRA_SRCS += traffic_info.c datalink.c -LOCAL_CFLAGS += -DMOBILE_CAM +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile + +ap.CFLAGS += -DUBX +ap.CFLAGS += -DDATALINK +ap.EXTRA_SRCS += traffic_info.c datalink.c +ap.CFLAGS += -DMOBILE_CAM +ap.EXTRA_SRCS += cam.c
diff --git a/conf/airframes/twinstar3.xml b/conf/airframes/twinstar3.xml deleted file mode 100755 index affdded8e9..0000000000 --- a/conf/airframes/twinstar3.xml +++ /dev/null @@ -1,90 +0,0 @@ - -
- - -
- - - - - - - - - - - - - - - - - - - - - -
- - -
-
- - - - - - - - - - -
-
- - - - - - - -
-
- - - - - - - - -
-
- - - -
-
- - - - - -
-
- - -
-
- - - -
-
- - - - - -
-
diff --git a/conf/airframes/twinstar4.xml b/conf/airframes/twinstar4.xml index 39eaf53a4f..92ab9ca41c 100755 --- a/conf/airframes/twinstar4.xml +++ b/conf/airframes/twinstar4.xml @@ -1,4 +1,4 @@ - +
@@ -86,9 +86,12 @@
-LOCAL_CFLAGS += -DDATALINK -AP_EXTRA_SRCS += traffic_info.c datalink.c -LOCAL_CFLAGS += -DWAVECARD -AP_EXTRA_SRCS += wavecard.c +include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile + +ap.CFLAGS += -DUBX +ap.LOCAL_CFLAGS += -DDATALINK +ap.EXTRA_SRCS += traffic_info.c datalink.c +ap.LOCAL_CFLAGS += -DWAVECARD +ap.EXTRA_SRCS += wavecard.c
diff --git a/sw/airborne/fly_by_wire/3dmg.c b/sw/airborne/3dmg.c similarity index 100% rename from sw/airborne/fly_by_wire/3dmg.c rename to sw/airborne/3dmg.c diff --git a/sw/airborne/fly_by_wire/3dmg.h b/sw/airborne/3dmg.h similarity index 100% rename from sw/airborne/fly_by_wire/3dmg.h rename to sw/airborne/3dmg.h diff --git a/sw/airborne/autopilot/Makefile b/sw/airborne/Makefile similarity index 53% rename from sw/airborne/autopilot/Makefile rename to sw/airborne/Makefile index 2b87eaad4c..162cc29c43 100644 --- a/sw/airborne/autopilot/Makefile +++ b/sw/airborne/Makefile @@ -21,63 +21,19 @@ # -FBW=../fly_by_wire - - -LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS) - VARINCLUDE=$(PAPARAZZI_HOME)/var/include ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) -ARCH = atmega128 -TARGET = autopilot -TARGETDIR = autopilot - -# LOW_FUSE = e0 -LOW_FUSE = a0 -HIGH_FUSE = 99 - -ifeq ($(SIMUL),1) -SIMUL_FLAGS= -DSIMUL -endif - -EXT_FUSE = ff -LOCK_FUSE = ff -INCLUDES = -I .. -I ../../include -I $(VARINCLUDE) -I $(ACINCLUDE) -I ../avr -I $(PAPARAZZI_SRC)/sw/airborne/autopilot - -GPS = gps_ubx.c -GPS_FLAGS=-DUBX - -ifndef ARCHDIR -ARCHDIR=avr -endif +INCLUDES = -I ../include -I $(VARINCLUDE) -I $(ACINCLUDE) -I $(ARCHI) -I $(PAPARAZZI_SRC)/sw/airborne SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/$(ARCHDIR) -$(TARGET).srcs = \ - main.c \ - $(SRC_ARCH)/modem.c \ - link_mcu.c \ - $(SRC_ARCH)/link_mcu_ap.c \ - $(SRC_ARCH)/spi_ap.c \ - $(SRC_ARCH)/adc_ap.c \ - $(GPS) \ - infrared.c \ - pid.c \ - nav.c \ - $(SRC_ARCH)/uart_ap.c \ - estimator.c \ - if_calib.c \ - mainloop.c \ - cam.c \ - - include $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/Makefile.ac -$(TARGET).srcs += $(AP_EXTRA_SRCS) -include ../../../conf/Makefile.local -include ../../../conf/Makefile.avr +$(TARGET).srcs += $($(TARGET).EXTRA_SRCS) +include ../../conf/Makefile.local +include ../../conf/Makefile.$(ARCHI) -autopilot.install : warn_conf +$(TARGET).install : warn_conf warn_conf : @echo @@ -88,10 +44,5 @@ warn_conf : @echo '###########################################################' @echo - -wavecard_glib : wavecard_glib.c wavecard.c wavecard_glib_utils.c - gcc -Wall -o $@ $^ `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` - - -clean : avr_clean - rm -f *.out *.cm* messages.h flight_plan.h ubx_protocol.h inflight_calib.h wavecard_glib +clean : + rm *~ diff --git a/sw/airborne/autopilot/ahrs.c b/sw/airborne/ahrs.c similarity index 100% rename from sw/airborne/autopilot/ahrs.c rename to sw/airborne/ahrs.c diff --git a/sw/airborne/autopilot/ahrs.h b/sw/airborne/ahrs.h similarity index 100% rename from sw/airborne/autopilot/ahrs.h rename to sw/airborne/ahrs.h diff --git a/sw/airborne/autopilot/autopilot.h b/sw/airborne/autopilot.h similarity index 100% rename from sw/airborne/autopilot/autopilot.h rename to sw/airborne/autopilot.h diff --git a/sw/airborne/autopilot/README b/sw/airborne/autopilot/README deleted file mode 100644 index d56db63899..0000000000 --- a/sw/airborne/autopilot/README +++ /dev/null @@ -1,24 +0,0 @@ -# $Id$ -# Copyright (C) 2003 Pascal Brisset Antoine Drouin -# -# This file is part of paparazzi. -# -# paparazzi is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# paparazzi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with paparazzi; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - - - - diff --git a/sw/airborne/autopilot/wavecard_glib.c.old b/sw/airborne/autopilot/wavecard_glib.c.old deleted file mode 100644 index 22815237a1..0000000000 --- a/sw/airborne/autopilot/wavecard_glib.c.old +++ /dev/null @@ -1,309 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "wavecard.h" -#include "wavecard_glib.h" -#include "wavecard_glib_utils.h" - - -struct WcGlib wc_glib; -static void wc_glib_setup_sig_handler( void ); -static void wc_glib_quit( int i ); -static guint usage (int argc, char** argv); -static guint parse_options (int argc, char** argv); -static gboolean timeout_callback(gpointer data); -void request_remote_rssi ( void ); -void request_self_address ( void ); - -#define NEXT_RSSI() { \ - wc_glib.requested_remote_rssi++; \ - wc_glib.requested_remote_rssi %= get_nb_hosts(); \ - if (wc_glib.requested_remote_rssi == wc_glib.self_id) { \ - wc_glib.requested_remote_rssi++; \ - wc_glib.requested_remote_rssi %= get_nb_hosts(); \ - } \ - } - -void on_wc_res_read_radio_param() { - g_message("got WC_RES_READ_RADIO_PARAM"); - if (wc_payload[1] == 0) { - switch (wc_glib.requested_radio_param) { - case WC_RADIO_PARAM_AWAKENING_PERIOD : - g_message("awakening period %d", wc_payload[2]); - break; - case WC_RADIO_PARAM_WAKE_UP_TYPE: - g_message("wake_up_type %d", wc_payload[2]); - break; - case WC_RADIO_PARAM_RADIO_ACKNOLEDGE : - g_message("radio_acknoledge %d", wc_payload[2]); - break; - case WC_RADIO_PARAM_WAKE_UP_LENGTH : { - uint16_t* len = (uint16_t*)&wc_payload[2]; - g_message("wake_up_length %d", *len); - } - break; - case WC_RADIO_PARAM_RADIO_ADDRESS : { - memcpy(wc_glib.self_addr, wc_payload, WC_ADDR_LEN); - wc_glib.status = WC_STATUS_GOT_SELFADDRESS; - GString* str = g_string_new("self_address "); - wc_glib_append_addr(str, &wc_payload[2]); - g_string_append_printf(str, " %s ", get_host_by_addr(&wc_payload[2])->name); - g_message(str->str); - g_string_free(str, TRUE); - request_remote_rssi(); - } - break; - case WC_RADIO_PARAM_SWITCH_MODE_STATUS: - g_message("switch_mode_status %s", wc_payload[2]?"ON":"OFF"); - break; - default: - g_message("radio param %02x %d", wc_glib.requested_radio_param, wc_payload[2]); - break; - } - } - else - g_message("WC_RES_READ_RADIO_PARAM failed"); -} - -static void priv_parse_payload() { - printf("got_message "); - int i; - for(i = 0; i < wc_length - 3; i++) - printf("%02x ", wc_payload[i]); - printf("\n"); - switch (wc_payload[0]) { - - case WC_RES_READ_RADIO_PARAM : - on_wc_res_read_radio_param(); - g_source_remove(wc_glib.timeout_id); - break; - case WC_RES_WRITE_RADIO_PARAM : - g_message("WC_RES_WRITE_RADIO_PARAM %s", wc_payload[1]?"FAILED":"OK"); - break; - case WC_RES_SEND_SERVICE : - g_message("got WC_RES_SEND_SERVICE"); - break; - case WC_SERVICE_RESPONSE : - g_message("got WC_SERVICE_RESPONSE"); - printf("addr : "); wc_glib_print_addr(&wc_payload[1]); - printf("\n"); - g_message("acquitement %d", wc_payload[7]); - g_message("type %d", wc_payload[8]); - g_message("rssi %d", wc_payload[9]); - g_message("periode reveil %d", wc_payload[10]); - g_message("type_2 %d", wc_payload[11]); - break; - - case WC_RES_SEND_FRAME : - g_message("got WC_RES_SEND_FRAME"); - break; - - case WC_RES_READ_REMOTE_RSSI : { - g_source_remove(wc_glib.timeout_id); - float percent = (float)wc_payload[1] / (float)0x2F * 100.; - GTimeVal now; - g_get_current_time(&now); - g_message("%ld.%06ld got WC_RES_READ_REMOTE_RSSI %s %.1f", now.tv_sec, now.tv_usec, get_host_by_id(wc_glib.requested_remote_rssi)->name, percent ); - NEXT_RSSI(); - request_remote_rssi(); - } - break; - - case WC_RES_READ_LOCAL_RSSI : - g_message("got WC_RES_READ_LOCAL_RSSI %d", wc_payload[1] ); - break; - - case WC_RECEIVED_FRAME : - g_message("got WC_RECEIVED_FRAME"); - GString* str = g_string_new("sender_address "); - wc_glib_append_addr(str, &wc_payload[1]); - g_string_append_printf(str, "data : %*s ", wc_length - WC_ADDR_LEN, &wc_payload[1+WC_ADDR_LEN]); - g_message(str->str); - g_string_free(str, TRUE); - break; - - case WC_ACK : - g_message("got ACK"); - break; - - case WC_NAK : - g_message("got NAK"); - break; - - default: - g_message("received unhandled %02x", wc_payload[0]); - } -} - -static gboolean on_data_received(GIOChannel *source, GIOCondition condition, gpointer data) { - guchar buf[128]; - gsize len; - GError *err = NULL; - g_io_channel_read_chars(source, buf, 3, &len, &err); - int i; - // g_message("received"); - // print_both(len, buf); - for (i=0; iaddr); - wc_glib.status = WC_STATUS_REMOTE_RSSI_REQUESTED; - wc_glib.timeout_id = g_timeout_add(4000, timeout_callback, in_ch); -} - -uint8_t hello[] = "HELLO WORLD W"; - -static gboolean timeout_callback(gpointer data) { - switch (wc_glib.status) { - case WC_STATUS_SELFADDRESS_REQUESTED : - g_message("local wavecard not responding"); - request_self_address(); - break; - case WC_STATUS_REMOTE_RSSI_REQUESTED : - g_message("distant wavecard not responding %s", get_host_by_id(wc_glib.requested_remote_rssi)->name); - NEXT_RSSI(); - request_remote_rssi (); - break; - } - - return FALSE; - - static uint8_t foo1 = 1; - if ( foo1 == 1) { - wc_glib.requested_radio_param = WC_RADIO_PARAM_RADIO_ADDRESS; - WcSendReadRadioParamReq(WC_RADIO_PARAM_RADIO_ADDRESS); - } - else if ( foo1 == 2) { - wc_glib.requested_radio_param = WC_RADIO_PARAM_SWITCH_MODE_STATUS; - //WcSendWriteRadioParamReq(WC_RADIO_PARAM_SWITCH_MODE_STATUS, 0); - WcSendReadRadioParamReq(WC_RADIO_PARAM_SWITCH_MODE_STATUS); - } - else if ( foo1 == 3) { - //wc_glib.requested_radio_param = WC_RADIO_PARAM_RADIO_ACKNOLEDGE; - //WcSendWriteRadioParamReq(WC_RADIO_PARAM_RADIO_ACKNOLEDGE, 1); - WcSendReadRadioParamReq(WC_RADIO_PARAM_RADIO_ACKNOLEDGE); - } - // else if ( foo1 == 2) { - // WcSendReqSelectChannel(0x01); - // WcSendReqReadChannel(); - // } - else if ( foo1 == 4) { - //WcSendReqSelectPhyconfig(0x00a3); - WcSendReqReadPhyconfig(); - } - else if ( foo1 == 5) { - wc_glib.requested_remote_rssi = 0; - WcSendReqReadRemoteRssi(get_host_by_id(wc_glib.requested_remote_rssi)->addr); - } - // else if (foo1 == 5) { - // WcSendReqReadLocalRssi(wc_glib.distant_addr); - // } - // else if (foo1 == 6) { - // WcSendReqSendService(wc_glib.distant_addr, 0x20); - // } - // else if (foo1 == 7) { - // WcSendFirmwareReq(); - // } - else if (foo1 > 7) { - static uint8_t foo = 1; - hello[12] = foo++; - // if (!wc_glib.options.silent) WcSendMsg(wc_glib.distant_addr, strlen(hello), hello); - } - foo1++; - - return TRUE; -} - -int main (int argc, char** argv) { - - if (parse_options(argc, argv)) - return usage(argc, argv); - - wc_glib_setup_sig_handler(); - wc_glib.in_ch = open_serial_port(wc_glib.options.serial_device); - in_ch = wc_glib.in_ch; - g_io_add_watch (wc_glib.in_ch, G_IO_IN , on_data_received, NULL); - // g_timeout_add(2000, timeout_callback, in_ch); - wc_glib.ml = g_main_loop_new(NULL, FALSE); - request_self_address(); - g_main_loop_run(wc_glib.ml); - - return 0; -} - -static void wc_glib_setup_sig_handler( void ) { - struct sigaction act; - act.sa_handler = wc_glib_quit; - act.sa_restorer = NULL; - if (sigaction(SIGINT, &act, NULL) < 0) - g_message("Could not install signal handler for quitting\n i will be unable to close log\n"); -} - -static void wc_glib_quit( int i ) { - printf("\nquitting\n"); - g_main_loop_quit(wc_glib.ml); -} - -static guint usage (int argc, char** argv) { - g_message("%s [-h] [-d serial_device]", argv[0]); - return -1; -} - -static guint parse_options (int argc, char** argv) { - const gchar *optstr = "h:d:s:p"; - gchar ch; - wc_glib.options.serial_device = "/dev/ttyS0"; - wc_glib.options.silent = FALSE; - while ((ch=getopt(argc,argv,optstr)) != -1) { - switch(ch) { - case 'h': - return -1; - case 'd': - wc_glib.options.serial_device = strdup(optarg); - break; - case 's': - wc_glib.options.silent = TRUE; - break; - case 'p': - wc_glib.options.poll_mode = TRUE; - break; - case '?': - printf("unrecognized option: %c\n",optopt); - return -1; - default: - printf("error? condition unaccounted for?\n"); - break; - } - } - g_message("%s starting", argv[0]); - g_message(" serial device : %s", wc_glib.options.serial_device); - return 0; -} diff --git a/sw/airborne/autopilot/wavecard_glib.h.old b/sw/airborne/autopilot/wavecard_glib.h.old deleted file mode 100644 index 9f4c0862c0..0000000000 --- a/sw/airborne/autopilot/wavecard_glib.h.old +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef WAVECARD_GLIB_H -#define WAVECARD_GLIB_H - -#include -#include - -#include "wavecard.h" - -struct WcGlibOptions { - gchar* serial_device; - gboolean silent; - gboolean poll_mode; -}; - -#define WC_STATUS_SELFADDRESS_REQUESTED 0 -#define WC_STATUS_GOT_SELFADDRESS 1 -#define WC_STATUS_REMOTE_RSSI_REQUESTED 2 - -struct WcGlib { - GMainLoop* ml; - GIOChannel* in_ch; - uint8_t requested_radio_param; - uint8_t requested_remote_rssi; - uint8_t self_addr[WC_ADDR_LEN]; - uint8_t self_id; - uint8_t status; - guint timeout_id; - guint last_poll; - struct WcGlibOptions options; -}; - -GIOChannel* in_ch; - -extern struct WcGlib wc_glib; - -#define WcPut1CtlByte(_byte) { \ - int bytes_written; \ - uint8_t b = _byte; \ - g_io_channel_write_chars (wc_glib.in_ch, &b, 1, &bytes_written, NULL); \ - g_io_channel_flush(wc_glib.in_ch, NULL); \ -} - -#endif /* WAVECARD_GLIB_H */ diff --git a/sw/airborne/autopilot/wavecard_glib_utils.c.old b/sw/airborne/autopilot/wavecard_glib_utils.c.old deleted file mode 100644 index 308612469f..0000000000 --- a/sw/airborne/autopilot/wavecard_glib_utils.c.old +++ /dev/null @@ -1,128 +0,0 @@ -#include "wavecard_glib_utils.h" -#include "wavecard.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -struct WavecardAddr hosts[] = { - { { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x34 }, "ground_station"}, - { { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x35 }, "twinstar3"}, - { { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x2d }, "microjet4"}, - { { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x36 }, "plaster1"}, - { { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x37 }, "gorazoptere"} -}; -uint8_t nb_hosts = 5; - -struct WavecardAddr* get_host_by_addr ( uint8_t* addr) { - uint8_t i; - while (i -#include - -#include "wavecard.h" - -struct WavecardAddr { - uint8_t addr[WC_ADDR_LEN]; - gchar* name; -}; - -struct WavecardAddr* get_host_by_addr ( uint8_t* addr); -struct WavecardAddr* get_host_by_name ( uint8_t* name); -struct WavecardAddr* get_host_by_id ( uint8_t id); -uint8_t get_nb_hosts (); - -GIOChannel* open_serial_port( const gchar* serial_dev); -void print_both(gsize len, guchar* buf); -void wc_glib_print_addr(uint8_t* addr); -void wc_glib_append_addr(GString* str, uint8_t* addr); - - - - -#endif /* WAVECARD_GLIB_UTILS_H */ diff --git a/sw/airborne/autopilot/ahrs.S b/sw/airborne/avr/ahrs_asm.S similarity index 100% rename from sw/airborne/autopilot/ahrs.S rename to sw/airborne/avr/ahrs_asm.S diff --git a/sw/airborne/autopilot/cam.c b/sw/airborne/cam.c old mode 100755 new mode 100644 similarity index 100% rename from sw/airborne/autopilot/cam.c rename to sw/airborne/cam.c diff --git a/sw/airborne/autopilot/cam.h b/sw/airborne/cam.h old mode 100755 new mode 100644 similarity index 100% rename from sw/airborne/autopilot/cam.h rename to sw/airborne/cam.h diff --git a/sw/airborne/fly_by_wire/control.c b/sw/airborne/control.c similarity index 100% rename from sw/airborne/fly_by_wire/control.c rename to sw/airborne/control.c diff --git a/sw/airborne/fly_by_wire/control.h b/sw/airborne/control.h similarity index 100% rename from sw/airborne/fly_by_wire/control.h rename to sw/airborne/control.h diff --git a/sw/airborne/autopilot/datalink.c b/sw/airborne/datalink.c similarity index 100% rename from sw/airborne/autopilot/datalink.c rename to sw/airborne/datalink.c diff --git a/sw/airborne/autopilot/datalink.h b/sw/airborne/datalink.h similarity index 100% rename from sw/airborne/autopilot/datalink.h rename to sw/airborne/datalink.h diff --git a/sw/airborne/autopilot/downlink.h b/sw/airborne/downlink.h similarity index 100% rename from sw/airborne/autopilot/downlink.h rename to sw/airborne/downlink.h diff --git a/sw/airborne/autopilot/estimator.c b/sw/airborne/estimator.c similarity index 100% rename from sw/airborne/autopilot/estimator.c rename to sw/airborne/estimator.c diff --git a/sw/airborne/autopilot/estimator.h b/sw/airborne/estimator.h similarity index 100% rename from sw/airborne/autopilot/estimator.h rename to sw/airborne/estimator.h diff --git a/sw/airborne/fly_by_wire/Makefile b/sw/airborne/fly_by_wire/Makefile deleted file mode 100644 index 77fd040925..0000000000 --- a/sw/airborne/fly_by_wire/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# $Id$ -# Copyright (C) 2003 Pascal Brisset, Antoine Drouin -# -# This file is part of paparazzi. -# -# paparazzi is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# paparazzi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with paparazzi; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - -LOCAL_CFLAGS= $(CTL_BRD_FLAGS) - -ARCH = atmega8 -TARGET = fbw -TARGETDIR = fbw -#LOW_FUSE = 3f # crystal # -#LOW_FUSE = 31 # internal 1MHz # -#LOW_FUSE = 1e # ceramic resonator slow rising power p26 # -LOW_FUSE = 2e # ceramic resonator slow rising power p26 # -HIGH_FUSE = cb -EXT_FUSE = ff -LOCK_FUSE = ff -VARINCLUDE = $(PAPARAZZI_HOME)/var/include -ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) -INCLUDES = -I ../../include -I .. -I ../avr -I $(VARINCLUDE) -I $(ACINCLUDE) -I $(PAPARAZZI_SRC)/sw/airborne/fly_by_wire - -ifeq ($(CTL_BRD_VERSION),V1_2_1) -CTL_BRD_FLAGS=-DCTL_BRD_V1_2_1 -endif - -ifeq ($(CTL_BRD_VERSION),V1_2) -CTL_BRD_FLAGS=-DCTL_BRD_V1_2 -endif - -SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/avr - -$(TARGET).srcs = \ - main.c \ - $(SRC_ARCH)/ppm.c \ - $(SRC_ARCH)/servo.c \ - $(SRC_ARCH)/spi_fbw.c \ - $(SRC_ARCH)/uart_fbw.c \ - $(SRC_ARCH)/adc_fbw.c \ - - -include $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/Makefile.ac -$(TARGET).srcs += $(FBW_EXTRA_SRCS) -include ../../../conf/Makefile.local -include ../../../conf/Makefile.avr - -fbw.install : warn_conf - -warn_conf : - @echo - @echo '###########################################################' - @grep AIRFRAME_NAME $(ACINCLUDE)/airframe.h - @grep RADIO_NAME $(ACINCLUDE)/radio.h - @echo '###########################################################' - @echo - - -$(OBJDIR)/servo.o : $(ACINCLUDE)/airframe.h - -clean : avr_clean - diff --git a/sw/airborne/fly_by_wire/README b/sw/airborne/fly_by_wire/README deleted file mode 100644 index d56db63899..0000000000 --- a/sw/airborne/fly_by_wire/README +++ /dev/null @@ -1,24 +0,0 @@ -# $Id$ -# Copyright (C) 2003 Pascal Brisset Antoine Drouin -# -# This file is part of paparazzi. -# -# paparazzi is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# paparazzi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with paparazzi; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - - - - diff --git a/sw/airborne/autopilot/gps.h b/sw/airborne/gps.h similarity index 100% rename from sw/airborne/autopilot/gps.h rename to sw/airborne/gps.h diff --git a/sw/airborne/autopilot/gps_ubx.c b/sw/airborne/gps_ubx.c similarity index 100% rename from sw/airborne/autopilot/gps_ubx.c rename to sw/airborne/gps_ubx.c diff --git a/sw/airborne/autopilot/if_calib.c b/sw/airborne/if_calib.c similarity index 100% rename from sw/airborne/autopilot/if_calib.c rename to sw/airborne/if_calib.c diff --git a/sw/airborne/autopilot/if_calib.h b/sw/airborne/if_calib.h similarity index 100% rename from sw/airborne/autopilot/if_calib.h rename to sw/airborne/if_calib.h diff --git a/sw/airborne/fly_by_wire/imu.c b/sw/airborne/imu.c similarity index 100% rename from sw/airborne/fly_by_wire/imu.c rename to sw/airborne/imu.c diff --git a/sw/airborne/fly_by_wire/imu.h b/sw/airborne/imu.h similarity index 100% rename from sw/airborne/fly_by_wire/imu.h rename to sw/airborne/imu.h diff --git a/sw/airborne/autopilot/infrared.c b/sw/airborne/infrared.c similarity index 100% rename from sw/airborne/autopilot/infrared.c rename to sw/airborne/infrared.c diff --git a/sw/airborne/autopilot/infrared.h b/sw/airborne/infrared.h similarity index 100% rename from sw/airborne/autopilot/infrared.h rename to sw/airborne/infrared.h diff --git a/sw/airborne/autopilot/link_mcu.c b/sw/airborne/link_mcu.c similarity index 100% rename from sw/airborne/autopilot/link_mcu.c rename to sw/airborne/link_mcu.c diff --git a/sw/airborne/autopilot/main.c b/sw/airborne/main_ap.c similarity index 100% rename from sw/airborne/autopilot/main.c rename to sw/airborne/main_ap.c diff --git a/sw/airborne/fly_by_wire/main.c b/sw/airborne/main_fbw.c similarity index 100% rename from sw/airborne/fly_by_wire/main.c rename to sw/airborne/main_fbw.c diff --git a/sw/airborne/autopilot/mainloop.c b/sw/airborne/mainloop.c similarity index 100% rename from sw/airborne/autopilot/mainloop.c rename to sw/airborne/mainloop.c diff --git a/sw/airborne/autopilot/nav.c b/sw/airborne/nav.c similarity index 100% rename from sw/airborne/autopilot/nav.c rename to sw/airborne/nav.c diff --git a/sw/airborne/autopilot/nav.h b/sw/airborne/nav.h similarity index 100% rename from sw/airborne/autopilot/nav.h rename to sw/airborne/nav.h diff --git a/sw/airborne/autopilot/pid.c b/sw/airborne/pid.c similarity index 100% rename from sw/airborne/autopilot/pid.c rename to sw/airborne/pid.c diff --git a/sw/airborne/autopilot/pid.h b/sw/airborne/pid.h similarity index 100% rename from sw/airborne/autopilot/pid.h rename to sw/airborne/pid.h diff --git a/sw/airborne/autopilot/srf08.c b/sw/airborne/srf08.c similarity index 100% rename from sw/airborne/autopilot/srf08.c rename to sw/airborne/srf08.c diff --git a/sw/airborne/autopilot/srf08.h b/sw/airborne/srf08.h similarity index 100% rename from sw/airborne/autopilot/srf08.h rename to sw/airborne/srf08.h diff --git a/sw/airborne/autopilot/traffic_info.c b/sw/airborne/traffic_info.c similarity index 100% rename from sw/airborne/autopilot/traffic_info.c rename to sw/airborne/traffic_info.c diff --git a/sw/airborne/autopilot/traffic_info.h b/sw/airborne/traffic_info.h similarity index 100% rename from sw/airborne/autopilot/traffic_info.h rename to sw/airborne/traffic_info.h diff --git a/sw/airborne/autopilot/ubx.h b/sw/airborne/ubx.h similarity index 100% rename from sw/airborne/autopilot/ubx.h rename to sw/airborne/ubx.h diff --git a/sw/airborne/autopilot/wavecard.c b/sw/airborne/wavecard.c similarity index 100% rename from sw/airborne/autopilot/wavecard.c rename to sw/airborne/wavecard.c diff --git a/sw/airborne/autopilot/wavecard.h b/sw/airborne/wavecard.h similarity index 100% rename from sw/airborne/autopilot/wavecard.h rename to sw/airborne/wavecard.h diff --git a/sw/simulator/Makefile b/sw/simulator/Makefile index 4d35670b42..cab64d3852 100644 --- a/sw/simulator/Makefile +++ b/sw/simulator/Makefile @@ -32,7 +32,7 @@ SIMHCMO=$(SIMHML:%.ml=%.cmo) SIMSML = stdlib.ml data.ml flightModel.ml gps.ml sitl.ml sim.ml SIMSCMO=$(SIMSML:%.ml=%.cmo) SIMSCMX=$(SIMSML:%.ml=%.cmx) -SIMSC = sim_ir.c sim_gps.c sim_ap.c estimator.c pid.c nav.c main.c cam.c traffic_info.c +SIMSC = sim_ir.c sim_gps.c sim_ap.c estimator.c pid.c nav.c main_ap.c cam.c traffic_info.c SIMSO=$(SIMSC:%.c=$(OBJDIR)/%.o) SIMSA=sims.cma @@ -42,8 +42,6 @@ INCLUDES= -I +lablgtk2 -I ../lib/ocaml OCAMLCC = gcc -O2 -I /usr/include/glib-2.0 -I /usr/lib/glib-2.0/include -DUBX -DMOBILE_CAM -I $(OBJDIR) -I $(ACDIR) AIRBORNE = ../airborne -FBW = ../airborne/fly_by_wire -AP = ../airborne/autopilot VARINCLUDE=$(PAPARAZZI_HOME)/var/include ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) @@ -79,20 +77,20 @@ gaia : gaia.cmo $(OCAMLC) -custom $(INCLUDES) -o $@ glibivy-ocaml.cma lib-pprz.cma lablgtk.cma gtkInit.cmo $< $(OBJDIR)/%.o : %.c - $(OCAMLCC) -c -o $@ -I $(SIMDIR) -I $(AIRBORNE) -I $(AP) -I ../include -I $(VARINCLUDE) $< + $(OCAMLCC) -c -o $@ -I $(SIMDIR) -I $(AIRBORNE) -I $(AIRBORNE) -I ../include -I $(VARINCLUDE) $< -$(OBJDIR)/%.o : $(AP)/%.c - $(OCAMLCC) -c -o $@ -I $(SIMDIR) -I $(AIRBORNE) -I $(AP) -I ../include -I $(VARINCLUDE) $< +$(OBJDIR)/%.o : $(AIRBORNE)/%.c + $(OCAMLCC) -c -o $@ -I $(SIMDIR) -I $(AIRBORNE) -I $(AIRBORNE) -I ../include -I $(VARINCLUDE) $< -$(OBJDIR)/main.o : $(OBJDIR)/main.c - $(OCAMLCC) -c -o $@ -I $(SIMDIR) -I $(AIRBORNE) -I $(AP) -I ../include -I $(VARINCLUDE) $< +$(OBJDIR)/main_ap.o : $(OBJDIR)/main_ap.c + $(OCAMLCC) -c -o $@ -I $(SIMDIR) -I $(AIRBORNE) -I $(AIRBORNE) -I ../include -I $(VARINCLUDE) $< -$(OBJDIR)/sim_gps.o $(OBJDIR)/nav.o $(OBJDIR)/main.o $(OBJDIR)/sim_ir.o $(OBJDIR)/sim_ap.o $(OBJDIR)/pid.o $(OBJDIR)/estimator.o $(OBJDIR)/cam.o : $(ACINCLUDE)/flight_plan.h $(ACINCLUDE)/airframe.h +$(OBJDIR)/sim_gps.o $(OBJDIR)/nav.o $(OBJDIR)/main_ap.o $(OBJDIR)/sim_ir.o $(OBJDIR)/sim_ap.o $(OBJDIR)/pid.o $(OBJDIR)/estimator.o $(OBJDIR)/cam.o : $(ACINCLUDE)/flight_plan.h $(ACINCLUDE)/airframe.h -$(OBJDIR)/sim_ap.o : $(AP)/traffic_info.h $(AP)/nav.h +$(OBJDIR)/sim_ap.o : $(AIRBORNE)/traffic_info.h $(AIRBORNE)/nav.h -$(OBJDIR)/main.c : $(OBJDIR)/downlink.h $(AP)/main.c - cp $(AP)/main.c $(@) +$(OBJDIR)/main_ap.c : $(OBJDIR)/downlink.h $(AIRBORNE)/main_ap.c + cp $(AIRBORNE)/main_ap.c $(@) $(OBJDIR)/downlink.h : $(MESSAGES) $(GEN_DOWNLINK) $(GEN_DOWNLINK) $< > $@ diff --git a/sw/tools/gen_airframe.ml b/sw/tools/gen_airframe.ml index 4f4d65d4d3..ec2d188fd0 100644 --- a/sw/tools/gen_airframe.ml +++ b/sw/tools/gen_airframe.ml @@ -166,9 +166,6 @@ let _ = 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"; - nl (); List.iter parse_section (Xml.children xml); finish h_name with