[modules] baro modules for real sensors only for ap target, not sim

This commit is contained in:
Felix Ruess
2013-10-07 18:44:49 +02:00
parent 49ab9baa7b
commit bfe0072f99
6 changed files with 4 additions and 42 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
<periodic fun="baro_amsys_read_periodic()" freq="10."/>
<event fun="BaroAmsysEvent()"/>
<makefile>
<makefile target="ap">
<file name="baro_amsys.c"/>
</makefile>
+1 -1
View File
@@ -31,7 +31,7 @@
<periodic fun="baro_ets_read_periodic()" freq="10."/>
<event fun="BaroEtsEvent()"/>
<makefile>
<makefile target="ap">
<file name="baro_ets.c"/>
</makefile>
+1 -1
View File
@@ -13,7 +13,7 @@
<periodic fun="baro_hca_read_periodic()" freq="10."/>
<event fun="BaroHcaEvent()"/>
<makefile>
<makefile target="ap">
<file name="baro_hca.c"/>
</makefile>
-20
View File
@@ -30,12 +30,6 @@
#include <math.h>
#include "generated/flight_plan.h" // for ground alt
#ifdef SITL
#include "subsystems/gps.h"
#include "subsystems/navigation/common_nav.h"
#include "math/pprz_isa.h"
#endif
//Messages
#include "mcu_periph/uart.h"
#include "messages.h"
@@ -128,7 +122,6 @@ void baro_amsys_init( void ) {
void baro_amsys_read_periodic( void ) {
// Initiate next read
#ifndef SITL
if (baro_amsys_i2c_trans.status == I2CTransDone){
#ifndef MEASURE_AMSYS_TEMPERATURE
i2c_receive(&BARO_AMSYS_I2C_DEV, &baro_amsys_i2c_trans, BARO_AMSYS_ADDR, 2);
@@ -136,19 +129,6 @@ void baro_amsys_read_periodic( void ) {
i2c_receive(&BARO_AMSYS_I2C_DEV, &baro_amsys_i2c_trans, BARO_AMSYS_ADDR, 4);
#endif
}
#else // SITL
/* fake an offset so sim works for under hmsl as well */
if (!baro_amsys_offset_init) {
baro_amsys_offset = BARO_AMSYS_OFFSET_MAX;
baro_amsys_offset_init = TRUE;
}
pBaroRaw = 0;
baro_amsys_altitude = gps.hmsl / 1000.0;
baro_amsys_p = pprz_isa_pressure_of_altitude(baro_amsys_altitude);
baro_amsys_adc = baro_amsys_p;
AbiSendMsgBARO_ABS(BARO_AMSYS_SENDER_ID, &baro_amsys_p);
baro_amsys_valid = TRUE;
#endif
#ifdef BARO_AMSYS_SYNC_SEND
DOWNLINK_SEND_AMSYS_BARO(DefaultChannel, DefaultDevice, &pBaroRaw, &baro_amsys_p, &baro_amsys_offset, &ref_alt_init, &baro_amsys_abs_altitude, &baro_amsys_altitude, &baro_amsys_temp);
-4
View File
@@ -36,11 +36,7 @@
extern struct Bmp085 baro_bmp;
/// new measurement every 3rd baro_bmp_periodic
#ifndef SITL
#define BARO_BMP_DT (BARO_BMP_PERIODIC_PERIOD / 3)
#else
#define BARO_BMP_DT BARO_BMP_PERIODIC_PERIOID
#endif
extern bool_t baro_bmp_enabled;
extern float baro_bmp_r;
+1 -15
View File
@@ -48,10 +48,6 @@
#include "subsystems/nav.h"
#ifdef SITL
#include "subsystems/gps.h"
#endif
#ifdef BARO_ETS_SYNC_SEND
#ifndef DOWNLINK_DEVICE
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
@@ -133,23 +129,13 @@ void baro_ets_init( void ) {
void baro_ets_read_periodic( void ) {
// Initiate next read
#ifndef SITL
if (!baro_ets_delay_done) {
if (SysTimeTimer(baro_ets_delay_time) < USEC_OF_SEC(BARO_ETS_START_DELAY)) return;
else baro_ets_delay_done = TRUE;
}
if (baro_ets_i2c_trans.status == I2CTransDone)
if (baro_ets_i2c_trans.status == I2CTransDone) {
i2c_receive(&BARO_ETS_I2C_DEV, &baro_ets_i2c_trans, BARO_ETS_ADDR, 2);
#else // SITL
/* fake an offset so sim works as well */
if (!baro_ets_offset_init) {
baro_ets_offset = 12400;
baro_ets_offset_init = TRUE;
}
baro_ets_altitude = gps.hmsl / 1000.0;
baro_ets_adc = baro_ets_offset - ((baro_ets_altitude - ground_alt) / BARO_ETS_SCALE);
baro_ets_valid = TRUE;
#endif
#ifdef BARO_ETS_SYNC_SEND
DOWNLINK_SEND_BARO_ETS(DefaultChannel, DefaultDevice, &baro_ets_adc, &baro_ets_offset, &baro_ets_altitude);