mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
Merge remote branch 'paparazzi/master' into nav
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<!ELEMENT param EMPTY>
|
||||
<!ELEMENT flag EMPTY>
|
||||
<!ELEMENT firmware (target|subsystem|define)*>
|
||||
<!ELEMENT target (param|define)*>
|
||||
<!ELEMENT target (param|define|subsystem)*>
|
||||
<!ELEMENT subsystem (param)*>
|
||||
|
||||
<!ATTLIST include
|
||||
|
||||
@@ -245,12 +245,7 @@
|
||||
<define name="AUTO2" value="AP_MODE_HOVER_Z_HOLD" />
|
||||
</section>
|
||||
|
||||
|
||||
<makefile target="opening">
|
||||
#empty
|
||||
</makefile>
|
||||
|
||||
<makefile target="closure" location="after">
|
||||
<makefile location="after">
|
||||
ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c
|
||||
sim.srcs += $(SRC_BOOZ_SIM)/booz2_pwm_hw.c
|
||||
</makefile>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
|
||||
CFG_FIXEDWING=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/fixedwing
|
||||
|
||||
|
||||
@@ -16,36 +16,40 @@ SRC_FIXEDWING_TEST=$(SRC_FIXEDWING)/
|
||||
SRC_FIRMWARE=firmwares/fixedwing
|
||||
SRC_SUBSYSTEMS=subsystems
|
||||
|
||||
FIXEDWING_INC = -I$(SRC_FIRMWARE) -I$(SRC_FIXEDWING) -I$(SRC_FIXEDWING_ARCH)
|
||||
FIXEDWING_INC = -I$(SRC_FIRMWARE) -I$(SRC_FIXEDWING)
|
||||
|
||||
|
||||
|
||||
# Standard Fixed Wing Code
|
||||
include $(CFG_FIXEDWING)/autopilot.makefile
|
||||
|
||||
# automatically include correct actuators for the ap target
|
||||
ifeq ($(TARGET),ap)
|
||||
|
||||
ifeq ($(ACTUATORS),)
|
||||
ifeq ($(BOARD),tiny)
|
||||
ifeq ($(BOARD_VERSION),1.1)
|
||||
include $(CFG_FIXEDWING)/actuators_4015.makefile
|
||||
else
|
||||
ifeq ($(BOARD_VERSION),0.99)
|
||||
include $(CFG_FIXEDWING)/actuators_4015.makefile
|
||||
ifeq ($(ACTUATORS),)
|
||||
ifeq ($(BOARD),tiny)
|
||||
ifeq ($(BOARD_VERSION),1.1)
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
include $(CFG_FIXEDWING)/actuators_4017.makefile
|
||||
ifeq ($(BOARD_VERSION),0.99)
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(BOARD),twog)
|
||||
include $(CFG_FIXEDWING)/actuators_4017.makefile
|
||||
ifeq ($(BOARD),twog)
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),lisa_l)
|
||||
include $(CFG_SHARED)/actuators_direct.makefile
|
||||
endif
|
||||
|
||||
else
|
||||
include $(CFG_FIXEDWING)/$(ACTUATORS).makefile
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),lisa_l)
|
||||
include $(CFG_FIXEDWING)/actuators_direct.makefile
|
||||
endif
|
||||
|
||||
else
|
||||
include $(CFG_FIXEDWING)/$(ACTUATORS).makefile
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
# MODEM_BAUD
|
||||
#
|
||||
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
|
||||
CFG_ROTORCRAFT=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/rotorcraft
|
||||
|
||||
SRC_BOOZ=booz
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
|
||||
#CFG_SETUP=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/setup
|
||||
|
||||
SRC_ARCH=arch/$(ARCH)
|
||||
SRC_FIRMWARE=firmwares/setup
|
||||
|
||||
CFG_SETUP=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/setup
|
||||
|
||||
|
||||
SRC_SETUP=.
|
||||
SRC_SETUP_ARCH=$(SRC_SETUP)/$(ARCH)
|
||||
SRC_SETUP_TEST=$(SRC_SETUP)/
|
||||
|
||||
SETUP_INC = -I$(SRC_SETUP) -I$(SRC_SETUP_ARCH)
|
||||
SETUP_INC = -I$(SRC_FIRMWARE)
|
||||
|
||||
|
||||
# for the usb_tunnel we need to set PCLK higher
|
||||
@@ -54,25 +52,25 @@ usb_tunnel_1.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
|
||||
ifeq ($(ACTUATORS),)
|
||||
ifeq ($(BOARD),tiny)
|
||||
ifeq ($(BOARD_VERSION),1.1)
|
||||
include $(CFG_SETUP)/actuators_4015.makefile
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
ifeq ($(BOARD_VERSION),0.99)
|
||||
include $(CFG_SETUP)/actuators_4015.makefile
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
include $(CFG_SETUP)/actuators_4017.makefile
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(BOARD),twog)
|
||||
include $(CFG_SETUP)/actuators_4017.makefile
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),lisa_l)
|
||||
include $(CFG_SETUP)/actuators_direct.makefile
|
||||
include $(CFG_SHARED)/actuators_direct.makefile
|
||||
endif
|
||||
|
||||
else
|
||||
include $(CFG_SETUP)/$(ACTUATORS).makefile
|
||||
include $(CFG_SHARED)/$(ACTUATORS).makefile
|
||||
endif
|
||||
|
||||
|
||||
@@ -82,4 +80,4 @@ setup_actuators.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart
|
||||
setup_actuators.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ
|
||||
setup_actuators.CFLAGS += -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1
|
||||
setup_actuators.CFLAGS += $(SETUP_INC) -Ifirmwares/fixedwing
|
||||
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c setup_actuators.c $(SRC_ARCH)/uart_hw.c firmwares/fixedwing/main.c
|
||||
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c $(SRC_FIRMWARE)/setup_actuators.c $(SRC_ARCH)/uart_hw.c firmwares/fixedwing/main.c
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# for Tiny v1.1
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT
|
||||
ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c
|
||||
ap.srcs += $(SRC_FIXEDWING)/actuators.c
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# for Tiny v2 or Twog v1
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
||||
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c $(SRC_FIXEDWING)/actuators.c
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# for lisa_l
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_direct_hw.h\" -DSERVOS_DIRECT
|
||||
ap.srcs += $(SRC_ARCH)/servos_direct_hw.c $(SRC_FIXEDWING)/actuators.c
|
||||
|
||||
|
||||
# TODO TODO UGLY HACK: We re-use the booz actuators: Should become universal actuator code!!
|
||||
# Carefull: paths might get broken with this silly rotorcraft/fixedwing mixup of directories
|
||||
|
||||
ifeq ($(ARCH), stm32)
|
||||
ap.srcs += firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c
|
||||
ap.CFLAGS += -Ifirmwares/rotorcraft/actuators/arch/stm32
|
||||
endif
|
||||
@@ -21,7 +21,7 @@ test_adcs.CFLAGS += -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1 -DADC -DUSE_ADC_
|
||||
test_adcs.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B9600
|
||||
test_adcs.srcs += downlink.c $(SRC_ARCH)/uart_hw.c xbee.c
|
||||
|
||||
test_adcs.srcs += sys_time.c $(SRC_ARCH)/adc_hw.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c test_adcs.c
|
||||
test_adcs.srcs += sys_time.c $(SRC_ARCH)/adc_hw.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c test/test_adcs.c
|
||||
# pprz_transport.c
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Autopilot
|
||||
#
|
||||
ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/ppm.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
ap.CFLAGS += -DUSE_TIM2_IRQ
|
||||
|
||||
#
|
||||
# Simulator
|
||||
#
|
||||
sim.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=1
|
||||
sim.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
sim.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
sim.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/ppm.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
|
||||
#
|
||||
# test_rc_ppm
|
||||
#
|
||||
# configuration
|
||||
# SYS_TIME_LED
|
||||
# MODEM_PORT
|
||||
# MODEM_BAUD
|
||||
# RADIO_CONTROL_LED
|
||||
#
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Makefile for radio_control susbsytem in rotorcraft firmware
|
||||
#
|
||||
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
|
||||
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
|
||||
endif
|
||||
|
||||
ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/spektrum.h\"
|
||||
ifeq ($(BOARD), booz)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
|
||||
endif
|
||||
ifdef RADIO_CONTROL_LED
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
|
||||
ap.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER -DUSE_TIM6_IRQ
|
||||
|
||||
ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/spektrum.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/spektrum_arch.c
|
||||
|
||||
-1
@@ -2,4 +2,3 @@
|
||||
|
||||
$(TARGET).CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT
|
||||
$(TARGET).srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c
|
||||
|
||||
-1
@@ -2,4 +2,3 @@
|
||||
|
||||
$(TARGET).CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
||||
$(TARGET).srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
|
||||
|
||||
+9
-17
@@ -1,3 +1,6 @@
|
||||
#
|
||||
# Makefile for shared radio_control ppm susbsytem
|
||||
#
|
||||
|
||||
NORADIO = False
|
||||
|
||||
@@ -7,25 +10,11 @@ ifeq ($(BOARD),classix)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
ifeq ($(ARCH),stm32)
|
||||
ap.CFLAGS += -DRADIO_CONTROL
|
||||
ifdef RADIO_CONTROL_LED
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/ppm.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
ap.CFLAGS += -DUSE_TIM2_IRQ
|
||||
|
||||
NORADIO = True
|
||||
endif
|
||||
|
||||
ifeq ($(NORADIO), False)
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL
|
||||
ifdef RADIO_CONTROL_LED
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control.c
|
||||
@@ -33,4 +22,7 @@ ifeq ($(NORADIO), False)
|
||||
ifneq ($(ARCH),jsbsim)
|
||||
$(TARGET).srcs += $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
endif
|
||||
ifeq ($(ARCH),stm32)
|
||||
ap.CFLAGS += -DUSE_TIM2_IRQ
|
||||
endif
|
||||
endif
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Makefile for radio_control susbsytem in fixedwing firmware
|
||||
# Makefile for shared radio_control spektrum susbsytem
|
||||
#
|
||||
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
|
||||
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "max1167.h"
|
||||
|
||||
|
||||
volatile uint8_t max1167_status;
|
||||
uint16_t max1167_values[MAX1167_NB_CHAN];
|
||||
|
||||
extern void max1167_init( void ) {
|
||||
max1167_hw_init();
|
||||
|
||||
uint8_t i;
|
||||
for (i=0; i<MAX1167_NB_CHAN; i++)
|
||||
max1167_values[i] = 0;
|
||||
|
||||
max1167_status = STA_MAX1167_IDLE;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef MAX1167_H
|
||||
#define MAX1167_H
|
||||
|
||||
#include "std.h"
|
||||
|
||||
#define MAX1167_NB_CHAN 4
|
||||
|
||||
extern void max1167_init( void );
|
||||
extern void max1167_read( void );
|
||||
|
||||
#define STA_MAX1167_IDLE 0
|
||||
#define STA_MAX1167_SENDING_REQ 1
|
||||
#define STA_MAX1167_READING_RES 2
|
||||
#define STA_MAX1167_DATA_AVAILABLE 3
|
||||
extern volatile uint8_t max1167_status;
|
||||
|
||||
extern uint16_t max1167_values[MAX1167_NB_CHAN];
|
||||
|
||||
|
||||
extern void max1167_hw_init( void );
|
||||
|
||||
#include "max1167_hw.h"
|
||||
|
||||
#endif /* MAX1167_H */
|
||||
@@ -102,6 +102,9 @@ LDFLAGS=`pkg-config gtk+-2.0 --libs` -s `pcre-config --libs` -lglibivy
|
||||
ant_track : ant_track.c
|
||||
$(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS)
|
||||
|
||||
ant_track_pmm : ant_track_pmm.c
|
||||
$(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_enose : test_enose.c sliding_plot.c
|
||||
$(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS) -lgtkdatabox
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Quiet compilation
|
||||
Q=@
|
||||
|
||||
CC = gcc
|
||||
CFLAGS=-g -O2 -Wall `pkg-config gtk+-2.0 --cflags` $(FPIC)
|
||||
LDFLAGS=`pkg-config gtk+-2.0 --libs` -s `pcre-config --libs` -lglibivy
|
||||
|
||||
ant_track_pmm : ant_track_pmm.c
|
||||
$(CC) $(CFLAGS) -g -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f *~* *.cm* *.o *.out *.opt .depend
|
||||
+269
-288
File diff suppressed because it is too large
Load Diff
+18
-18
@@ -2,7 +2,7 @@
|
||||
* $Id$
|
||||
*
|
||||
* XML preprocessing for airframe parameters
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
@@ -20,7 +20,7 @@
|
||||
* 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.
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*)
|
||||
|
||||
@@ -59,7 +59,7 @@ let define_macro name n x =
|
||||
| 2 -> printf "x1,x2) (%s*(x1)+ %s*(x2))\n" (a "coeff1") (a "coeff2")
|
||||
| 3 -> printf "x1,x2,x3) (%s*(x1)+ %s*(x2)+%s*(x3))\n" (a "coeff1") (a "coeff2") (a "coeff3")
|
||||
| _ -> failwith "define_macro"
|
||||
|
||||
|
||||
let define_integer name v n =
|
||||
let max_val = 1 lsl n in
|
||||
let print = fun name num den ->
|
||||
@@ -84,11 +84,11 @@ let define_integer name v n =
|
||||
let parse_element = fun prefix s ->
|
||||
match Xml.tag s with
|
||||
"define" -> begin
|
||||
try
|
||||
define (prefix^ExtXml.attrib s "name") (ExtXml.display_entities (ExtXml.attrib s "value"));
|
||||
define_integer (prefix^(ExtXml.attrib s "name")) (ExtXml.float_attrib s "value") (ExtXml.int_attrib s "integer");
|
||||
with _ -> ();
|
||||
end
|
||||
try
|
||||
define (prefix^ExtXml.attrib s "name") (ExtXml.display_entities (ExtXml.attrib s "value"));
|
||||
define_integer (prefix^(ExtXml.attrib s "name")) (ExtXml.float_attrib s "value") (ExtXml.int_attrib s "integer");
|
||||
with _ -> ();
|
||||
end
|
||||
| "linear" ->
|
||||
let name = ExtXml.attrib s "name"
|
||||
and n = int_of_string (ExtXml.attrib s "arity") in
|
||||
@@ -107,7 +107,7 @@ let parse_servo = fun driver c ->
|
||||
let min = fos (ExtXml.attrib c "min" )
|
||||
and neutral = fos (ExtXml.attrib c "neutral")
|
||||
and max = fos (ExtXml.attrib c "max" ) in
|
||||
|
||||
|
||||
let travel_up = (max-.neutral) /. max_pprz
|
||||
and travel_down = (neutral-.min) /. max_pprz in
|
||||
|
||||
@@ -153,7 +153,7 @@ let parse_command_laws = fun command ->
|
||||
let var = a "var"
|
||||
and value = a "value" in
|
||||
let v = preprocess_value value "values" "COMMAND" in
|
||||
printf " int16_t _var_%s = %s;\\\n" var v
|
||||
printf " int16_t _var_%s = %s;\\\n" var v
|
||||
| "define" ->
|
||||
parse_element "" command
|
||||
| _ -> xml_error "set|let"
|
||||
@@ -162,7 +162,7 @@ let parse_csc_fields = fun csc_fields ->
|
||||
let a = fun s -> ExtXml.attrib csc_fields s in
|
||||
match Xml.tag csc_fields with
|
||||
"field_map" ->
|
||||
let servo_id = a "servo_id"
|
||||
let servo_id = a "servo_id"
|
||||
and field = a "field" in
|
||||
printf " temp.%s = actuators[%s]; \\\n" field servo_id;
|
||||
| _ -> xml_error "field_map"
|
||||
@@ -171,8 +171,8 @@ let parse_csc_messages = (let msg_index_ref = ref 0 in fun csc_id csc_messages -
|
||||
let a = fun s -> ExtXml.attrib csc_messages s in
|
||||
match Xml.tag csc_messages with
|
||||
"msg" ->
|
||||
let msg_id = a "id"
|
||||
and msg_type = a "type"
|
||||
let msg_id = a "id"
|
||||
and msg_type = a "type"
|
||||
and msg_index = msg_index_ref.contents in
|
||||
msg_index_ref.contents <- msg_index + 1;
|
||||
printf "{\\\n struct Csc%s temp; \\\n" msg_type;
|
||||
@@ -204,7 +204,7 @@ let parse_rc_commands = fun rc ->
|
||||
let var = a "var"
|
||||
and value = a "value" in
|
||||
let v = preprocess_value value "rc_values" "RADIO" in
|
||||
printf " int16_t _var_%s = %s;\\\n" var v
|
||||
printf " int16_t _var_%s = %s;\\\n" var v
|
||||
| "define" ->
|
||||
parse_element "" rc
|
||||
| _ -> xml_error "set|let"
|
||||
@@ -221,7 +221,7 @@ let parse_ap_only_commands = fun ap_only ->
|
||||
let parse_subsystem_defines = fun options ->
|
||||
match Xml.tag options with
|
||||
"param" ->
|
||||
printf "// -param: %s\n" (ExtXml.attrib options "name")
|
||||
printf "// -param: %s\n" (ExtXml.attrib options "name")
|
||||
| "define" ->
|
||||
printf "#define %s %s\n" (ExtXml.attrib options "name") (ExtXml.attrib options "value")
|
||||
| _ -> xml_error "define|param"
|
||||
@@ -230,7 +230,7 @@ let parse_subsystem_defines = fun options ->
|
||||
let parse_subsystems = fun subsystem ->
|
||||
match Xml.tag subsystem with
|
||||
"param" ->
|
||||
printf "// subsystem parameter: %s\n" (ExtXml.attrib subsystem "name")
|
||||
printf "// subsystem parameter: %s\n" (ExtXml.attrib subsystem "name")
|
||||
| "subsystem" ->
|
||||
printf "// -%s:\n" (ExtXml.attrib subsystem "name");
|
||||
List.iter parse_subsystem_defines (Xml.children subsystem)
|
||||
@@ -307,7 +307,7 @@ let rec parse_section = fun s ->
|
||||
()
|
||||
(** Ignoring this section *)
|
||||
| _ -> ()
|
||||
|
||||
|
||||
|
||||
let h_name = "AIRFRAME_H"
|
||||
|
||||
@@ -319,7 +319,7 @@ let hex_to_bin = fun s ->
|
||||
b.[4*i] <- '\\';
|
||||
Scanf.sscanf (String.sub s (2*i) 2) "%2x"
|
||||
(fun x ->
|
||||
String.blit (sprintf "%03o" x) 0 b (4*i+1) 3)
|
||||
String.blit (sprintf "%03o" x) 0 b (4*i+1) 3)
|
||||
done;
|
||||
b
|
||||
|
||||
|
||||
+284
-285
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -2,7 +2,7 @@
|
||||
* $Id$
|
||||
*
|
||||
* XML preprocessing for modules
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2009 Gautier Hattenberger
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
@@ -20,7 +20,7 @@
|
||||
* 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.
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*)
|
||||
|
||||
@@ -102,7 +102,7 @@ let remove_dup = fun l ->
|
||||
match l with
|
||||
[] | [_] -> l
|
||||
| x::((x'::_) as xs) ->
|
||||
if x = x' then loop xs else x::loop xs in
|
||||
if x = x' then loop xs else x::loop xs in
|
||||
loop (List.sort compare l)
|
||||
|
||||
let print_periodic_functions = fun modules ->
|
||||
@@ -117,7 +117,7 @@ let print_periodic_functions = fun modules ->
|
||||
let functions_modulo = List.flatten (List.map (fun m ->
|
||||
let periodic = List.filter (fun i -> (String.compare (Xml.tag i) "periodic") == 0) (Xml.children m) in
|
||||
let module_name = ExtXml.attrib m "name" in
|
||||
List.map (fun x ->
|
||||
List.map (fun x ->
|
||||
try
|
||||
let p = float_of_string (Xml.attrib x "period") in
|
||||
let _ = try let _ = Xml.attrib x "freq" in fprintf stderr "Warning: both period and freq are defined but only period is used for function %s\n" (ExtXml.attrib x "fun") with _ -> () in
|
||||
@@ -178,7 +178,7 @@ let print_periodic_functions = fun modules ->
|
||||
lprintf out_h "}\n";
|
||||
end
|
||||
end
|
||||
else
|
||||
else
|
||||
begin
|
||||
if (test_delay func) then begin
|
||||
(** Delay is set by user *)
|
||||
@@ -229,7 +229,7 @@ let print_event_functions = fun modules ->
|
||||
|
||||
let print_datalink_functions = fun modules ->
|
||||
lprintf out_h "\n#include \"messages.h\"\n";
|
||||
lprintf out_h "#include \"airframe.h\"\n";
|
||||
lprintf out_h "#include \"generated/airframe.h\"\n";
|
||||
lprintf out_h "static inline void modules_parse_datalink(uint8_t msg_id __attribute__ ((unused))) {\n";
|
||||
right ();
|
||||
let else_ = ref "" in
|
||||
@@ -267,16 +267,16 @@ let get_modules = fun dir m ->
|
||||
let name = ExtXml.attrib m "name" in
|
||||
let xml = Xml.parse_file (dir^name) in
|
||||
xml
|
||||
end
|
||||
end
|
||||
| _ -> xml_error "load"
|
||||
|
||||
let test_section_modules = fun xml ->
|
||||
List.fold_right (fun x r -> ExtXml.tag_is x "modules" || r) (Xml.children xml) false
|
||||
List.fold_right (fun x r -> ExtXml.tag_is x "modules" || r) (Xml.children xml) false
|
||||
|
||||
(** Check dependencies *)
|
||||
let pipe_regexp = Str.regexp "|"
|
||||
let dep_of_field = fun field att ->
|
||||
try
|
||||
try
|
||||
Str.split pipe_regexp (Xml.attrib field att)
|
||||
with
|
||||
_ -> []
|
||||
@@ -310,7 +310,7 @@ let write_settings = fun xml_file out_set modules ->
|
||||
match Xml.tag i with
|
||||
"periodic" ->
|
||||
if not (is_status_lock i) then begin
|
||||
if (not !setting_exist) then begin
|
||||
if (not !setting_exist) then begin
|
||||
fprintf out_set " <dl_settings name=\"Modules\">\n";
|
||||
setting_exist := true;
|
||||
end;
|
||||
@@ -326,7 +326,7 @@ let write_settings = fun xml_file out_set modules ->
|
||||
|
||||
let get_targets_of_module = fun m ->
|
||||
let pipe_regexp = Str.regexp "|" in
|
||||
let targets_of_field = fun field -> try
|
||||
let targets_of_field = fun field -> try
|
||||
Str.split pipe_regexp (ExtXml.attrib_or_default field "target" "ap|sim") with _ -> [] in
|
||||
let rec singletonize = fun l ->
|
||||
match l with
|
||||
@@ -380,7 +380,7 @@ let () =
|
||||
freq := main_freq;
|
||||
let modules_list = List.map (get_modules modules_dir) (Xml.children modules) in
|
||||
let modules_list = unload_unused_modules modules_list in
|
||||
let modules_name =
|
||||
let modules_name =
|
||||
(List.map (fun l -> try Xml.attrib l "name" with _ -> "") (Xml.children modules)) @
|
||||
(List.map (fun m -> try Xml.attrib m "name" with _ -> "") modules_list) in
|
||||
check_dependencies modules_list modules_name;
|
||||
|
||||
+34
-34
@@ -2,7 +2,7 @@
|
||||
* $Id$
|
||||
*
|
||||
* XML preprocessing for dynamic tuning
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2006 Pascal Brisset, Antoine Drouin
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
@@ -20,7 +20,7 @@
|
||||
* 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.
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*)
|
||||
|
||||
@@ -44,50 +44,50 @@ let rec flatten = fun xml r ->
|
||||
match Xml.children xml with
|
||||
[] -> r
|
||||
| x::xs ->
|
||||
List.iter (fun y -> assert(ExtXml.tag_is y (Xml.tag x))) xs;
|
||||
List.fold_right flatten (x::xs) r
|
||||
List.iter (fun y -> assert(ExtXml.tag_is y (Xml.tag x))) xs;
|
||||
List.fold_right flatten (x::xs) r
|
||||
|
||||
|
||||
module StringSet = Set.Make(struct type t = string let compare = compare end)
|
||||
|
||||
|
||||
|
||||
let print_dl_settings = fun settings ->
|
||||
let settings = flatten settings [] in
|
||||
|
||||
(** include headers **)
|
||||
let modules = ref StringSet.empty in
|
||||
List.iter
|
||||
List.iter
|
||||
(fun s ->
|
||||
try
|
||||
modules := StringSet.add (ExtXml.attrib s "module") !modules
|
||||
modules := StringSet.add (ExtXml.attrib s "module") !modules
|
||||
with ExtXml.Error e -> ()
|
||||
)
|
||||
)
|
||||
settings;
|
||||
|
||||
lprintf "\n";
|
||||
StringSet.iter (fun m -> lprintf "#include \"%s.h\"\n" m) !modules;
|
||||
lprintf "#include \"modules.h\"\n";
|
||||
lprintf "#include \"generated/modules.h\"\n";
|
||||
lprintf "\n";
|
||||
|
||||
|
||||
(** Macro to call to set one variable *)
|
||||
lprintf "#define DlSetting(_idx, _value) { \\\n";
|
||||
right ();
|
||||
lprintf "switch (_idx) { \\\n";
|
||||
right ();
|
||||
let idx = ref 0 in
|
||||
List.iter
|
||||
List.iter
|
||||
(fun s ->
|
||||
let v = ExtXml.attrib s "var" in
|
||||
begin
|
||||
try
|
||||
let h = ExtXml.attrib s "handler" and
|
||||
m = ExtXml.attrib s "module" in
|
||||
lprintf "case %d: %s_%s( _value ); _value = %s; break;\\\n" !idx (Filename.basename m) h v
|
||||
with
|
||||
ExtXml.Error e -> lprintf "case %d: %s = _value; break;\\\n" !idx v
|
||||
end;
|
||||
incr idx
|
||||
)
|
||||
begin
|
||||
try
|
||||
let h = ExtXml.attrib s "handler" and
|
||||
m = ExtXml.attrib s "module" in
|
||||
lprintf "case %d: %s_%s( _value ); _value = %s; break;\\\n" !idx (Filename.basename m) h v
|
||||
with
|
||||
ExtXml.Error e -> lprintf "case %d: %s = _value; break;\\\n" !idx v
|
||||
end;
|
||||
incr idx
|
||||
)
|
||||
settings;
|
||||
lprintf "default: break;\\\n";
|
||||
left ();
|
||||
@@ -106,10 +106,10 @@ let print_dl_settings = fun settings ->
|
||||
let idx = ref 0 in
|
||||
lprintf "switch (i) { \\\n";
|
||||
right ();
|
||||
List.iter
|
||||
List.iter
|
||||
(fun s ->
|
||||
let v = ExtXml.attrib s "var" in
|
||||
lprintf "case %d: var = %s; break;\\\n" !idx v; incr idx)
|
||||
let v = ExtXml.attrib s "var" in
|
||||
lprintf "case %d: var = %s; break;\\\n" !idx v; incr idx)
|
||||
settings;
|
||||
lprintf "default: var = 0.; break;\\\n";
|
||||
left ();
|
||||
@@ -126,16 +126,16 @@ let print_dl_settings = fun settings ->
|
||||
let idx = ref 0 in
|
||||
lprintf "switch (i) { \\\n";
|
||||
right ();
|
||||
List.iter
|
||||
List.iter
|
||||
(fun s ->
|
||||
let v = ExtXml.attrib s "var" in
|
||||
lprintf "case %d: return %s;\n" !idx v; incr idx)
|
||||
lprintf "case %d: return %s;\n" !idx v; incr idx)
|
||||
settings;
|
||||
lprintf "default: return 0.;\n";
|
||||
lprintf "}\n";
|
||||
left ();
|
||||
lprintf "}\n"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -190,12 +190,12 @@ let join_xml_files = fun xml_files ->
|
||||
and rc_settings = ref [] in
|
||||
List.iter (fun xml_file ->
|
||||
let xml = Xml.parse_file xml_file in
|
||||
let these_rc_settings =
|
||||
let these_rc_settings =
|
||||
try Xml.children (ExtXml.child xml "rc_settings") with
|
||||
Not_found -> [] in
|
||||
let these_dl_settings =
|
||||
try Xml.children (ExtXml.child xml "dl_settings") with
|
||||
Not_found -> [] in
|
||||
Not_found -> [] in
|
||||
let these_dl_settings =
|
||||
try Xml.children (ExtXml.child xml "dl_settings") with
|
||||
Not_found -> [] in
|
||||
rc_settings := these_rc_settings @ !rc_settings;
|
||||
dl_settings := these_dl_settings @ !dl_settings)
|
||||
xml_files;
|
||||
@@ -211,11 +211,11 @@ let _ =
|
||||
for i = 2 to Array.length Sys.argv - 1 do
|
||||
xml_files := Sys.argv.(i) :: !xml_files;
|
||||
done;
|
||||
|
||||
|
||||
try
|
||||
printf "/* This file has been generated from %s */\n" (String.concat " " !xml_files);
|
||||
printf "/* Please DO NOT EDIT */\n\n";
|
||||
|
||||
|
||||
printf "#ifndef %s\n" h_name;
|
||||
define h_name "";
|
||||
nl ();
|
||||
|
||||
Reference in New Issue
Block a user