diff --git a/conf/airframes/examples/quadrotor_lisa_mx.xml b/conf/airframes/examples/quadrotor_lisa_mx.xml index 3452e08df1..e66fc89f7e 100644 --- a/conf/airframes/examples/quadrotor_lisa_mx.xml +++ b/conf/airframes/examples/quadrotor_lisa_mx.xml @@ -43,6 +43,9 @@ + + + diff --git a/conf/airframes/examples/setup_lisam2.xml b/conf/airframes/examples/setup_lisam2.xml index 73ce8b63d0..0e167a4ae5 100644 --- a/conf/airframes/examples/setup_lisam2.xml +++ b/conf/airframes/examples/setup_lisam2.xml @@ -28,7 +28,11 @@ - + + + + + diff --git a/conf/firmwares/test_progs.makefile b/conf/firmwares/test_progs.makefile index ccbd484e74..b09342197e 100644 --- a/conf/firmwares/test_progs.makefile +++ b/conf/firmwares/test_progs.makefile @@ -286,7 +286,6 @@ test_baro_board.CFLAGS += $(COMMON_TEST_CFLAGS) test_baro_board.srcs += $(COMMON_TEST_SRCS) test_baro_board.CFLAGS += $(COMMON_TELEMETRY_CFLAGS) test_baro_board.srcs += $(COMMON_TELEMETRY_SRCS) -test_baro_board.srcs += subsystems/air_data.c test_baro_board.srcs += test/test_baro_board.c test_baro_board.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c ifeq ($(TARGET),test_baro_board) diff --git a/sw/airborne/boards/booz/test_baro.c b/sw/airborne/boards/booz/test_baro.c deleted file mode 100644 index c38934df68..0000000000 --- a/sw/airborne/boards/booz/test_baro.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/* - * - * test baro using interrupts - * - */ - -#include BOARD_CONFIG - -#include "mcu.h" - -#include "mcu_periph/sys_time.h" -#include "subsystems/datalink/downlink.h" -#include "subsystems/sensors/baro.h" - -static inline void main_init( void ); -static inline void main_periodic_task( void ); -static inline void main_event_task( void ); - -static inline void main_on_baro_diff(void); -static inline void main_on_baro_abs(void); - - -int main(void) { - main_init(); - - while(1) { - if (sys_time_check_and_ack_timer(0)) - main_periodic_task(); - main_event_task(); - } - - return 0; -} - -static inline void main_init( void ) { - mcu_init(); - sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL); - booz2_analog_init(); - baro_init(); - mcu_int_enable(); -} - - - -static inline void main_periodic_task( void ) { - - RunOnceEvery(2, {baro_periodic();}); - RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);}); - LED_PERIODIC(); - -} - - - -static inline void main_event_task( void ) { - BaroEvent(main_on_baro_abs, main_on_baro_diff); -} - - -static inline void main_on_baro_diff(void) { - -} - -static inline void main_on_baro_abs(void) { - RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);}); -} diff --git a/sw/airborne/test/test_baro_board.c b/sw/airborne/test/test_baro_board.c index 2147d6b559..133c368470 100644 --- a/sw/airborne/test/test_baro_board.c +++ b/sw/airborne/test/test_baro_board.c @@ -35,7 +35,6 @@ #include "subsystems/datalink/downlink.h" #include "subsystems/sensors/baro.h" -#include "subsystems/air_data.h" #define ABI_C #include "subsystems/abi.h" @@ -44,9 +43,23 @@ static inline void main_init( void ); static inline void main_periodic_task( void ); static inline void main_event_task( void ); -static inline void main_on_baro_diff(void); -static inline void main_on_baro_abs(void); +#ifndef BARO_PERIODIC_FREQUENCY +#define BARO_PERIODIC_FREQUENCY 50 +#endif +PRINT_CONFIG_VAR(BARO_PERIODIC_FREQUENCY) +#ifdef BARO_LED +PRINT_CONFIG_VAR(BARO_LED) +#endif + +/** ABI bindings + */ +#ifndef BARO_ABS_ID +#define BARO_ABS_ID ABI_BROADCAST +#endif +static abi_event pressure_abs_ev; + +tid_t baro_tid; int main(void) { main_init(); @@ -54,21 +67,30 @@ int main(void) { while(1) { if (sys_time_check_and_ack_timer(0)) main_periodic_task(); + if (sys_time_check_and_ack_timer(baro_tid)) + baro_periodic(); main_event_task(); } return 0; } +static void pressure_abs_cb(uint8_t __attribute__((unused)) sender_id, const float * pressure) { + float foo = 42.; + DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, pressure, &foo); +} + static inline void main_init( void ) { mcu_init(); sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL); baro_init(); + + baro_tid = sys_time_register_timer(1./BARO_PERIODIC_FREQUENCY, NULL); + + AbiBindMsgBARO_ABS(BARO_ABS_ID, &pressure_abs_ev, pressure_abs_cb); } static inline void main_periodic_task( void ) { - - RunOnceEvery(2, {baro_periodic();}); LED_PERIODIC(); RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);}); } @@ -76,11 +98,3 @@ static inline void main_periodic_task( void ) { static inline void main_event_task( void ) { BaroEvent(); } - -static inline void main_on_baro_diff(void) { - -} - -static inline void main_on_baro_abs(void) { - RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &air_data.pressure, &air_data.differential);}); -}