From 85b82e75f6776c15fb04777807c345f4a3c48e75 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 8 Dec 2011 22:48:22 -0800 Subject: [PATCH] ArduPlane: update AP_Baro construtors and initializers --- ArduPlane/ArduPlane.pde | 12 +++++++++++- ArduPlane/system.pde | 6 +----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index 1d2d049f49..18e8b72349 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -137,7 +137,17 @@ static AP_ADC_ADS7844 adc; AP_Baro_BMP085_HIL barometer; AP_Compass_HIL compass; #else -static AP_Baro_BMP085 barometer; + +#if CONFIG_BARO == AP_BARO_BMP085 +# if CONFIG_HARDWARE == CONFIG_HARDWARE_APM2 +static AP_Baro_BMP085 barometer(true); +# else +static AP_Baro_BMP085 barometer(false); +# endif +#elif CONFIG_BARO == AP_BARO_MS5611 +static AP_Baro_MS5611 barometer; +#endif + static AP_Compass_HMC5843 compass(Parameters::k_param_compass); #endif diff --git a/ArduPlane/system.pde b/ArduPlane/system.pde index aaae707ef8..e544e151be 100644 --- a/ArduPlane/system.pde +++ b/ArduPlane/system.pde @@ -177,11 +177,7 @@ static void init_ardupilot() adc.Init(&timer_scheduler); // APM ADC library initialization -#if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 - barometer.Init(1, true); -#else - barometer.Init(1, false); -#endif + barometer.init(&timer_scheduler); if (g.compass_enabled==true) { compass.set_orientation(MAG_ORIENTATION); // set compass's orientation on aircraft