From 89d2f0f84975bc323e9e80564f0e402fece3a5b5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 13 Nov 2011 13:47:54 +1100 Subject: [PATCH] mod barometer.Init() based on hardware --- ArduCopter/system.pde | 13 +++++++++---- ArduPlane/system.pde | 10 ++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ArduCopter/system.pde b/ArduCopter/system.pde index 116bebe3e8..be4bc71d49 100644 --- a/ArduCopter/system.pde +++ b/ArduCopter/system.pde @@ -187,13 +187,18 @@ static void init_ardupilot() init_camera(); - #if HIL_MODE != HIL_MODE_ATTITUDE +#if HIL_MODE != HIL_MODE_ATTITUDE // begin filtering the ADC Gyros adc.filter_result = true; + adc.Init(); // APM ADC library initialization - adc.Init(); // APM ADC library initialization - barometer.Init(); // APM Abs Pressure sensor initialization - #endif +#if CONFIG_APM_HARDWARE == APM_HARDWARE_PURPLE + barometer.Init(1, true); +#else + barometer.Init(1, false); +#endif + +#endif // Do GPS init g_gps = &g_gps_driver; diff --git a/ArduPlane/system.pde b/ArduPlane/system.pde index 6e352014a1..ce93be40a0 100644 --- a/ArduPlane/system.pde +++ b/ArduPlane/system.pde @@ -137,8 +137,14 @@ static void init_ardupilot() #if HIL_MODE != HIL_MODE_ATTITUDE - adc.Init(); // APM ADC library initialization - barometer.Init(); // APM Abs Pressure sensor initialization + + adc.Init(); // APM ADC library initialization + +#if CONFIG_APM_HARDWARE == APM_HARDWARE_PURPLE + barometer.Init(1, true); +#else + barometer.Init(1, false); +#endif if (g.compass_enabled==true) { compass.set_orientation(MAG_ORIENTATION); // set compass's orientation on aircraft