diff --git a/conf/airframes/gorazoptere_brushless_3DMG.xml b/conf/airframes/gorazoptere_brushless_3DMG.xml index bb255e72ae..1a67b5e2d3 100644 --- a/conf/airframes/gorazoptere_brushless_3DMG.xml +++ b/conf/airframes/gorazoptere_brushless_3DMG.xml @@ -1,6 +1,5 @@ -
- +
diff --git a/conf/airframes/gorazoptere_brushless_ANALOG.xml b/conf/airframes/gorazoptere_brushless_ANALOG.xml index 6b3781711c..fdf2be82dc 100644 --- a/conf/airframes/gorazoptere_brushless_ANALOG.xml +++ b/conf/airframes/gorazoptere_brushless_ANALOG.xml @@ -1,11 +1,10 @@ -
- +
-
+
diff --git a/sw/airborne/autopilot/autopilot.h b/sw/airborne/autopilot/autopilot.h index 99237f54e2..04678478cc 100644 --- a/sw/airborne/autopilot/autopilot.h +++ b/sw/airborne/autopilot/autopilot.h @@ -70,15 +70,6 @@ extern uint8_t ir_estim_mode; #define STICK_PUSHED(pprz) (pprz < TRESHOLD1 || pprz > TRESHOLD2) -#define TRIM_PPRZ(pprz) (pprz < MIN_PPRZ ? MIN_PPRZ : \ - (pprz > MAX_PPRZ ? MAX_PPRZ : \ - pprz)) - -#define TRIM_UPPRZ(pprz) (pprz < 0 ? 0 : \ - (pprz > MAX_PPRZ ? MAX_PPRZ : \ - pprz)) - - #define FLOAT_OF_PPRZ(pprz, center, travel) ((float)pprz / (float)MAX_PPRZ * travel + center) extern uint8_t fatal_error_nb; diff --git a/sw/airborne/fly_by_wire/3dmg.c b/sw/airborne/fly_by_wire/3dmg.c index 61008e5c47..d96d76a353 100644 --- a/sw/airborne/fly_by_wire/3dmg.c +++ b/sw/airborne/fly_by_wire/3dmg.c @@ -1,4 +1,32 @@ +/* + * Paparazzi $Id$ + * + * Copyright (C) 2005 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. + * + */ +#include "airframe.h" + +#ifdef SECTION_IMU_3DMG + +#warning "Compiling 3dmg.c" #include "std.h" #include @@ -138,3 +166,5 @@ static inline void on_3dmg_receive(uint8_t c) { ReceiveUart(on_3dmg_receive); + +#endif // IMU_3DMG diff --git a/sw/airborne/fly_by_wire/3dmg.h b/sw/airborne/fly_by_wire/3dmg.h index d30f61845d..91db1ae099 100644 --- a/sw/airborne/fly_by_wire/3dmg.h +++ b/sw/airborne/fly_by_wire/3dmg.h @@ -6,6 +6,8 @@ void _3dmg_capture_gyro_bias ( void ); void _3dmg_set_continuous_mode ( void ); +void _3dmg_capture_neutral ( void ); + extern volatile bool_t _3dmg_data_ready; extern int16_t _3dmg_roll, _3dmg_pitch, _3dmg_yaw; extern int16_t _3dmg_roll_dot, _3dmg_pitch_dot, _3dmg_yaw_dot; diff --git a/sw/airborne/fly_by_wire/control.c b/sw/airborne/fly_by_wire/control.c index 4f21f3cd59..d1b88487fe 100644 --- a/sw/airborne/fly_by_wire/control.c +++ b/sw/airborne/fly_by_wire/control.c @@ -1,11 +1,35 @@ -#include "control.h" -#include "imu.h" +/* + * Paparazzi $Id$ + * + * Copyright (C) 2005 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. + * + */ + #include "airframe.h" -/* WARNING : taken from ../autopilot/autopilot.h */ -#define TRIM_PPRZ(pprz) (pprz < MIN_PPRZ ? MIN_PPRZ : \ - (pprz > MAX_PPRZ ? MAX_PPRZ : \ - pprz)) +#ifdef SECTION_RATE_LOOP +#warning "Compiling control.c" + +#include "control.h" +#include "imu.h" + int16_t desired_roll_dot; float roll_dot_pgain = ROLL_DOT_PGAIN; @@ -73,3 +97,5 @@ void control_set_desired ( const pprz_t values[] ) { desired_yaw_dot = DESIRED_OF_RADIO_YAW_DOT*values[RADIO_YAW]; desired_throttle = values[RADIO_THROTTLE]; } + +#endif diff --git a/sw/airborne/fly_by_wire/imu.c b/sw/airborne/fly_by_wire/imu.c index 9c0080f223..81fffc38b8 100644 --- a/sw/airborne/fly_by_wire/imu.c +++ b/sw/airborne/fly_by_wire/imu.c @@ -1,10 +1,39 @@ -#include "imu.h" +/* + * Paparazzi $Id$ + * + * Copyright (C) 2005 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. + * + */ #include "airframe.h" +#if defined(SECTION_IMU_3DMG) && defined(SECTION_IMU_ANALOG) +#error "IMU_3DMG and IMU_ANALOG cannot be defined simultaneously +#endif + +#include "imu.h" + int16_t roll_dot, pitch_dot, yaw_dot; -#ifdef IMU_TYPE_3DMG +#ifdef SECTION_IMU_3DMG +#warning "Compiling imu.c for 3DMG" #include "3dmg.h" int16_t roll, pitch, yaw; @@ -26,9 +55,10 @@ void imu_capture_neutral ( void ) { _3dmg_capture_neutral(); } -#endif +#endif // 3DMG -#ifdef IMU_TYPE_ANALOG +#ifdef SECTION_IMU_ANALOG +#warning "Compiling imu.c for ANALOG" #include "adc_fbw.h" struct adc_buf buf_roll_dot; @@ -64,4 +94,5 @@ void imu_capture_neutral ( void ) { raw_yaw_dot_neutral = raw_yaw_dot; } -#endif +#endif // ANALOG + diff --git a/sw/airborne/fly_by_wire/link_autopilot.h b/sw/airborne/fly_by_wire/link_autopilot.h index bf2ad8d7fa..976e2ac050 100644 --- a/sw/airborne/fly_by_wire/link_autopilot.h +++ b/sw/airborne/fly_by_wire/link_autopilot.h @@ -40,6 +40,13 @@ typedef int16_t pprz_t; // type of commands /* !!!!!!!!!!!!!!!!!!! Value used in gen_airframe.ml !!!!!!!!!!!!!!!!! */ #define MAX_PPRZ (600 * CLOCK) #define MIN_PPRZ -MAX_PPRZ +#define TRIM_PPRZ(pprz) (pprz < MIN_PPRZ ? MIN_PPRZ : \ + (pprz > MAX_PPRZ ? MAX_PPRZ : \ + pprz)) +#define TRIM_UPPRZ(pprz) (pprz < 0 ? 0 : \ + (pprz > MAX_PPRZ ? MAX_PPRZ : \ + pprz)) + struct inter_mcu_msg { pprz_t channels[RADIO_CTL_NB]; diff --git a/sw/tools/gen_airframe.ml b/sw/tools/gen_airframe.ml index a054e8c422..1e2d1d7310 100644 --- a/sw/tools/gen_airframe.ml +++ b/sw/tools/gen_airframe.ml @@ -106,6 +106,7 @@ let parse_section = fun s -> match Xml.tag s with "section" -> let prefix = ExtXml.attrib_or_default s "prefix" "" in + define ("SECTION_"^ExtXml.attrib s "name") "1"; List.iter (parse_element prefix) (Xml.children s); nl () | "servos" ->