Plane: use sensors from board subtypes
This commit is contained in:
parent
fdeac40135
commit
ae29a24348
@ -154,15 +154,8 @@ static void print_flight_mode(AP_HAL::BetterStream *port, uint8_t mode);
|
||||
static DataFlash_APM1 DataFlash;
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
static DataFlash_APM2 DataFlash;
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
|
||||
static DataFlash_File DataFlash("logs");
|
||||
//static DataFlash_SITL DataFlash;
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
static DataFlash_File DataFlash("/fs/microsd/APM/LOGS");
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
static DataFlash_File DataFlash("logs");
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
|
||||
static DataFlash_File DataFlash("/fs/microsd/APM/LOGS");
|
||||
#elif defined(HAL_BOARD_LOG_DIRECTORY)
|
||||
static DataFlash_File DataFlash(HAL_BOARD_LOG_DIRECTORY);
|
||||
#else
|
||||
// no dataflash driver
|
||||
DataFlash_Empty DataFlash;
|
||||
@ -195,57 +188,53 @@ static AP_GPS gps;
|
||||
// flight modes convenience array
|
||||
static AP_Int8 *flight_modes = &g.flight_mode1;
|
||||
|
||||
#if CONFIG_BARO == AP_BARO_BMP085
|
||||
#if CONFIG_BARO == HAL_BARO_BMP085
|
||||
static AP_Baro_BMP085 barometer;
|
||||
#elif CONFIG_BARO == AP_BARO_PX4
|
||||
#elif CONFIG_BARO == HAL_BARO_PX4
|
||||
static AP_Baro_PX4 barometer;
|
||||
#elif CONFIG_BARO == AP_BARO_VRBRAIN
|
||||
#elif CONFIG_BARO == HAL_BARO_VRBRAIN
|
||||
static AP_Baro_VRBRAIN barometer;
|
||||
#elif CONFIG_BARO == AP_BARO_HIL
|
||||
#elif CONFIG_BARO == HAL_BARO_HIL
|
||||
static AP_Baro_HIL barometer;
|
||||
#elif CONFIG_BARO == AP_BARO_MS5611
|
||||
#if CONFIG_MS5611_SERIAL == AP_BARO_MS5611_SPI
|
||||
static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::spi);
|
||||
#elif CONFIG_MS5611_SERIAL == AP_BARO_MS5611_I2C
|
||||
static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::i2c);
|
||||
#else
|
||||
#error Unrecognized CONFIG_MS5611_SERIAL setting.
|
||||
#endif
|
||||
#elif CONFIG_BARO == HAL_BARO_MS5611
|
||||
static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::i2c);
|
||||
#elif CONFIG_BARO == HAL_BARO_MS5611_SPI
|
||||
static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::spi);
|
||||
#else
|
||||
#error Unrecognized CONFIG_BARO setting
|
||||
#endif
|
||||
|
||||
#if CONFIG_COMPASS == AP_COMPASS_PX4
|
||||
#if CONFIG_COMPASS == HAL_COMPASS_PX4
|
||||
static AP_Compass_PX4 compass;
|
||||
#elif CONFIG_COMPASS == AP_COMPASS_VRBRAIN
|
||||
#elif CONFIG_COMPASS == HAL_COMPASS_VRBRAIN
|
||||
static AP_Compass_VRBRAIN compass;
|
||||
#elif CONFIG_COMPASS == AP_COMPASS_HMC5843
|
||||
#elif CONFIG_COMPASS == HAL_COMPASS_HMC5843
|
||||
static AP_Compass_HMC5843 compass;
|
||||
#elif CONFIG_COMPASS == AP_COMPASS_HIL
|
||||
#elif CONFIG_COMPASS == HAL_COMPASS_HIL
|
||||
static AP_Compass_HIL compass;
|
||||
#else
|
||||
#error Unrecognized CONFIG_COMPASS setting
|
||||
#endif
|
||||
|
||||
#if CONFIG_INS_TYPE == CONFIG_INS_OILPAN || CONFIG_HAL_BOARD == HAL_BOARD_APM1
|
||||
#if CONFIG_INS_TYPE == HAL_INS_OILPAN || CONFIG_HAL_BOARD == HAL_BOARD_APM1
|
||||
AP_ADC_ADS7844 apm1_adc;
|
||||
#endif
|
||||
|
||||
#if CONFIG_INS_TYPE == CONFIG_INS_MPU6000
|
||||
#if CONFIG_INS_TYPE == HAL_INS_MPU6000
|
||||
AP_InertialSensor_MPU6000 ins;
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_PX4
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_PX4
|
||||
AP_InertialSensor_PX4 ins;
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_VRBRAIN
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_VRBRAIN
|
||||
AP_InertialSensor_VRBRAIN ins;
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_HIL
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_HIL
|
||||
AP_InertialSensor_HIL ins;
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_OILPAN
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_OILPAN
|
||||
AP_InertialSensor_Oilpan ins( &apm1_adc );
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_FLYMAPLE
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_FLYMAPLE
|
||||
AP_InertialSensor_Flymaple ins;
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_L3G4200D
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_L3G4200D
|
||||
AP_InertialSensor_L3G4200D ins;
|
||||
#elif CONFIG_INS_TYPE == CONFIG_INS_MPU9250
|
||||
#elif CONFIG_INS_TYPE == HAL_INS_MPU9250
|
||||
AP_InertialSensor_MPU9250 ins;
|
||||
#else
|
||||
#error Unrecognised CONFIG_INS_TYPE setting.
|
||||
|
@ -80,56 +80,14 @@
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// main board differences
|
||||
//
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_OILPAN
|
||||
# define CONFIG_BARO AP_BARO_BMP085
|
||||
# define CONFIG_COMPASS AP_COMPASS_HMC5843
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_MPU6000
|
||||
# ifdef APM2_BETA_HARDWARE
|
||||
# define CONFIG_BARO AP_BARO_BMP085
|
||||
# else // APM2 Production Hardware (default)
|
||||
# define CONFIG_BARO AP_BARO_MS5611
|
||||
# define CONFIG_MS5611_SERIAL AP_BARO_MS5611_SPI
|
||||
# endif
|
||||
# define CONFIG_COMPASS AP_COMPASS_HMC5843
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_HIL
|
||||
# define CONFIG_BARO AP_BARO_HIL
|
||||
# define CONFIG_COMPASS AP_COMPASS_HIL
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_PX4
|
||||
# define CONFIG_BARO AP_BARO_PX4
|
||||
# define CONFIG_COMPASS AP_COMPASS_PX4
|
||||
# define SERIAL0_BAUD 115200
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_FLYMAPLE
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_FLYMAPLE
|
||||
# define CONFIG_BARO AP_BARO_BMP085
|
||||
# define CONFIG_COMPASS AP_COMPASS_HMC5843
|
||||
# define SERIAL0_BAUD 115200
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
# define BATTERY_VOLT_PIN -1
|
||||
# define BATTERY_CURR_PIN -1
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_MPU9250
|
||||
# define CONFIG_BARO AP_BARO_MS5611
|
||||
# define CONFIG_MS5611_SERIAL AP_BARO_MS5611_SPI
|
||||
# define CONFIG_COMPASS AP_COMPASS_HMC5843
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
|
||||
# define CONFIG_INS_TYPE CONFIG_INS_VRBRAIN
|
||||
# define CONFIG_BARO AP_BARO_VRBRAIN
|
||||
# define CONFIG_COMPASS AP_COMPASS_VRBRAIN
|
||||
# define SERIAL0_BAUD 115200
|
||||
#endif
|
||||
// sensor types
|
||||
|
||||
#define CONFIG_INS_TYPE HAL_INS_DEFAULT
|
||||
#define CONFIG_BARO HAL_BARO_DEFAULT
|
||||
#define CONFIG_COMPASS HAL_COMPASS_DEFAULT
|
||||
|
||||
#ifndef CONFIG_BARO
|
||||
# error "CONFIG_BARO not set"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_COMPASS
|
||||
# error "CONFIG_COMPASS not set"
|
||||
#ifdef HAL_SERIAL0_BAUD_DEFAULT
|
||||
# define SERIAL0_BAUD HAL_SERIAL0_BAUD_DEFAULT
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -141,11 +99,11 @@
|
||||
|
||||
#if HIL_MODE != HIL_MODE_DISABLED // we are in HIL mode
|
||||
#undef CONFIG_BARO
|
||||
#define CONFIG_BARO AP_BARO_HIL
|
||||
#define CONFIG_BARO HAL_BARO_HIL
|
||||
#undef CONFIG_INS_TYPE
|
||||
#define CONFIG_INS_TYPE CONFIG_INS_HIL
|
||||
#define CONFIG_INS_TYPE HAL_INS_HIL
|
||||
#undef CONFIG_COMPASS
|
||||
#define CONFIG_COMPASS AP_COMPASS_HIL
|
||||
#define CONFIG_COMPASS HAL_COMPASS_HIL
|
||||
#endif
|
||||
|
||||
#ifndef MAV_SYSTEM_ID
|
||||
|
@ -197,29 +197,6 @@ enum log_messages {
|
||||
// mark a function as not to be inlined
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
|
||||
// InertialSensor driver types
|
||||
#define CONFIG_INS_OILPAN 1
|
||||
#define CONFIG_INS_MPU6000 2
|
||||
#define CONFIG_INS_HIL 3
|
||||
#define CONFIG_INS_PX4 4
|
||||
#define CONFIG_INS_FLYMAPLE 5
|
||||
#define CONFIG_INS_L3G4200D 6
|
||||
#define CONFIG_INS_VRBRAIN 7
|
||||
#define CONFIG_INS_MPU9250 8
|
||||
|
||||
// barometer driver types
|
||||
#define AP_BARO_BMP085 1
|
||||
#define AP_BARO_MS5611 2
|
||||
#define AP_BARO_PX4 3
|
||||
#define AP_BARO_HIL 4
|
||||
#define AP_BARO_VRBRAIN 5
|
||||
|
||||
// compass driver types
|
||||
#define AP_COMPASS_HMC5843 1
|
||||
#define AP_COMPASS_PX4 2
|
||||
#define AP_COMPASS_HIL 3
|
||||
#define AP_COMPASS_VRBRAIN 4
|
||||
|
||||
// altitude control algorithms
|
||||
enum {
|
||||
ALT_CONTROL_DEFAULT = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user