From ef6519e40636fd78612211ea287590baa0a92a4d Mon Sep 17 00:00:00 2001 From: "rmackay9@yahoo.com" Date: Mon, 22 Nov 2010 13:53:13 +0000 Subject: [PATCH] ArduCopterNG - small cosmetic change & small change to how Wire.begin is called (now only called once). http://www.arduino.cc/en/Reference/WireBegin git-svn-id: https://arducopter.googlecode.com/svn/trunk@885 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- ArducopterNG/ArducopterNG.pde | 7 ++++--- ArducopterNG/System.pde | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ArducopterNG/ArducopterNG.pde b/ArducopterNG/ArducopterNG.pde index 440372180d..bb4ce1762d 100644 --- a/ArducopterNG/ArducopterNG.pde +++ b/ArducopterNG/ArducopterNG.pde @@ -165,12 +165,9 @@ #include #include // ArduPilot Mega RC Library #include // ArduPilot Mega Analog to Digital Converter Library -APM_ADC_Class APM_ADC; // Declare an instance #include // ArduPilot Mega BMP085 Library -APM_BMP085_Class APM_BMP085;// Declare an instance #include // ArduPilot Mega Flash Memory Library #include // ArduPilot Mega Magnetometer Library -APM_Compass_Class APM_Compass; // Declare an instance #include // I2C Communication library #include // EEPROM //#include @@ -189,6 +186,10 @@ APM_Compass_Class APM_Compass; // Declare an instance /* Software version */ #define VER 1.52 // Current software version (only numeric values) +// Sensors - declare one global instance +APM_ADC_Class APM_ADC; +APM_BMP085_Class APM_BMP085; +APM_Compass_Class APM_Compass; /* ************************************************************ */ /* ************* MAIN PROGRAM - DECLARATIONS ****************** */ diff --git a/ArducopterNG/System.pde b/ArducopterNG/System.pde index 375daf3320..73876770f5 100644 --- a/ArducopterNG/System.pde +++ b/ArducopterNG/System.pde @@ -125,9 +125,12 @@ void APM_Init() { APM_RC.OutputCh(2,MIN_THROTTLE); APM_RC.OutputCh(3,MIN_THROTTLE); + // Initialise Wire library used by Magnetometer and Barometer + Wire.begin(); + #ifdef IsMAG if (MAGNETOMETER == 1) { - APM_Compass.Init(); // I2C initialization + APM_Compass.Init(FALSE); // I2C initialization APM_Compass.SetOrientation(MAGORIENTATION); APM_Compass.SetOffsets(MAGOFFSET); APM_Compass.SetDeclination(ToRad(DECLINATION)); @@ -169,7 +172,7 @@ void APM_Init() { #endif #ifdef UseBMP - APM_BMP085.Init(); + APM_BMP085.Init(FALSE); #endif delay(1000);