Skip to content

Commit

Permalink
[tests] fix test_baro
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Sep 6, 2013
1 parent 5e4f494 commit 54c14ae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
31 changes: 19 additions & 12 deletions conf/firmwares/lisa_test_progs.makefile
Expand Up @@ -190,6 +190,8 @@ test_baro.srcs += $(COMMON_TELEMETRY_SRCS)

test_baro.CFLAGS += -I$(SRC_LISA)

test_baro.srcs += subsystems/air_data.c

ifeq ($(BOARD), lisa_l)
test_baro.CFLAGS += -DUSE_I2C2
test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
Expand All @@ -200,31 +202,36 @@ test_baro.srcs += $(SRC_LISA)/test_baro_i2c.c
else ifeq ($(BOARD), lisa_m)
# defaults to i2c baro bmp085 on the board
LISA_M_BARO ?= BARO_BOARD_BMP085
ifeq ($(LISA_M_BARO), BARO_MS5611_SPI)
include $(CFG_SHARED)/spi_master.makefile
test_baro.CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
test_baro.srcs += peripherals/ms5611.c
test_baro.srcs += peripherals/ms5611_spi.c
test_baro.srcs += subsystems/sensors/baro_ms5611_spi.c
test_baro.srcs += $(SRC_LISA)/test_baro_spi.c
else ifeq ($(LISA_M_BARO), BARO_MS5611_I2C)
ifeq ($(LISA_M_BARO), BARO_MS5611_I2C)
test_baro.CFLAGS += -DUSE_I2C2
test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
test_baro.CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
test_baro.srcs += peripherals/ms5611.c
test_baro.srcs += peripherals/ms5611_i2c.c
test_baro.srcs += subsystems/sensors/baro_ms5611_i2c.c
test_baro.srcs += boards/baro_board_ms5611_i2c.c
test_baro.srcs += $(SRC_LISA)/test_baro_i2c.c
else ifeq ($(LISA_M_BARO), BARO_BOARD_BMP085)
test_baro.CFLAGS += -DUSE_I2C2
test_baro.CFLAGS += -DUSE_I2C2
test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
test_baro.srcs += peripherals/bmp085.c
test_baro.srcs += $(SRC_BOARD)/baro_board.c
test_baro.srcs += $(SRC_LISA)/test_baro_i2c.c
endif
test_baro.CFLAGS += -D$(LISA_M_BARO)
endif

# Lia baro (no bmp onboard)
else ifeq ($(BOARD), lia)
LIA_BARO ?= BARO_MS5611_SPI
ifeq ($(LIA_BARO), BARO_MS5611_I2C)
test_baro.CFLAGS += -DUSE_I2C2
test_baro.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
test_baro.CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
test_baro.srcs += peripherals/ms5611.c
test_baro.srcs += peripherals/ms5611_i2c.c
test_baro.srcs += boards/baro_board_ms5611_i2c.c
test_baro.srcs += $(SRC_LISA)/test_baro_i2c.c
endif

endif

#
# test_rc_spektrum : sends RADIO_CONTROL messages on telemetry
Expand Down
8 changes: 6 additions & 2 deletions sw/airborne/lisa/test_baro_i2c.c
Expand Up @@ -36,8 +36,12 @@
#include "subsystems/datalink/downlink.h"

#include "subsystems/sensors/baro.h"
#include "subsystems/air_data.h"
//#include "my_debug_servo.h"

#define ABI_C
#include "subsystems/abi.h"

static inline void main_init( void );
static inline void main_periodic_task( void );
static inline void main_event_task( void );
Expand Down Expand Up @@ -107,7 +111,7 @@ static inline void main_periodic_task( void ) {


static inline void main_event_task( void ) {
BaroEvent(main_on_baro_abs, main_on_baro_diff);
baro_event();
}


Expand All @@ -117,5 +121,5 @@ 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);});
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &air_data.pressure, &air_data.differential);});
}

0 comments on commit 54c14ae

Please sign in to comment.