From ab37f833dba988b31d92833ff58109bfff1726af Mon Sep 17 00:00:00 2001 From: James Bielman Date: Tue, 8 Jan 2013 10:25:51 -0800 Subject: [PATCH] MS5611: Fix CONFIG_MS5611_SERIAL definitions. - Make sure the values are defined as integers. We were always using SPI rather than using I2C when desired. --- ArduCopter/ArduCopter.pde | 4 ++-- ArduCopter/config.h | 2 +- ArduCopter/defines.h | 3 +++ ArduPlane/ArduPlane.pde | 4 ++-- ArduPlane/config.h | 2 +- Tools/VARTest/config.h | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 7bd96c2741..b27814302f 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -209,9 +209,9 @@ AP_Baro_BMP085 barometer; #elif CONFIG_BARO == AP_BARO_PX4 AP_Baro_PX4 barometer; #elif CONFIG_BARO == AP_BARO_MS5611 - #if CONFIG_MS5611_SERIAL == SPI + #if CONFIG_MS5611_SERIAL == AP_BARO_MS5611_SPI AP_Baro_MS5611 barometer(&AP_Baro_MS5611::spi); - #elif CONFIG_MS5611_SERIAL == I2C + #elif CONFIG_MS5611_SERIAL == AP_BARO_MS5611_I2C AP_Baro_MS5611 barometer(&AP_Baro_MS5611::i2c); #else #error Unrecognized CONFIG_MS5611_SERIAL setting. diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 3150684988..5df69c4973 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -63,7 +63,7 @@ # define CONFIG_BARO AP_BARO_BMP085 # else // APM2 Production Hardware (default) # define CONFIG_BARO AP_BARO_MS5611 - # define CONFIG_MS5611_SERIAL SPI + # define CONFIG_MS5611_SERIAL AP_BARO_MS5611_SPI # endif #elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL # define CONFIG_IMU_TYPE CONFIG_IMU_SITL diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index ffc95a666e..52a401b2f7 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -424,6 +424,9 @@ enum gcs_severity { #define AP_BARO_MS5611 2 #define AP_BARO_PX4 3 +#define AP_BARO_MS5611_SPI 1 +#define AP_BARO_MS5611_I2C 2 + // Error message sub systems and error codes #define ERROR_SUBSYSTEM_MAIN 1 #define ERROR_SUBSYSTEM_RADIO 2 diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index 33e82d6dd7..9ad9c9317b 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -155,9 +155,9 @@ static AP_Baro_BMP085 barometer; #elif CONFIG_BARO == AP_BARO_PX4 static AP_Baro_PX4 barometer; #elif CONFIG_BARO == AP_BARO_MS5611 - #if CONFIG_MS5611_SERIAL == SPI + #if CONFIG_MS5611_SERIAL == AP_BARO_MS5611_SPI static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::spi); - #elif CONFIG_MS5611_SERIAL == I2C + #elif CONFIG_MS5611_SERIAL == AP_BARO_MS5611_I2C static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::i2c); #else #error Unrecognized CONFIG_MS5611_SERIAL setting. diff --git a/ArduPlane/config.h b/ArduPlane/config.h index 0b10d81ebb..ea3ad9d44c 100644 --- a/ArduPlane/config.h +++ b/ArduPlane/config.h @@ -121,7 +121,7 @@ # define CONFIG_BARO AP_BARO_BMP085 # else // APM2 Production Hardware (default) # define CONFIG_BARO AP_BARO_MS5611 - # define CONFIG_MS5611_SERIAL SPI + # define CONFIG_MS5611_SERIAL AP_BARO_MS5611_SPI # endif #elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL # define A_LED_PIN 27 diff --git a/Tools/VARTest/config.h b/Tools/VARTest/config.h index 5e30d213ce..3ffa73ac25 100644 --- a/Tools/VARTest/config.h +++ b/Tools/VARTest/config.h @@ -54,7 +54,7 @@ # define CONFIG_PITOT_SOURCE PITOT_SOURCE_ANALOG_PIN # define MAGNETOMETER ENABLED # define CONFIG_BARO AP_BARO_MS5611 -# define CONFIG_MS5611_SERIAL SPI +# define CONFIG_MS5611_SERIAL AP_BARO_MS5611_SPI # define A_LED_PIN 27 # define B_LED_PIN 26