From e9bb030fd44d3dd6cb1b33052e2b7723ebbce4f4 Mon Sep 17 00:00:00 2001 From: "tridge60@gmail.com" Date: Sat, 2 Jul 2011 11:31:27 +0000 Subject: [PATCH] AP_Compass: report compass initialisation failure don't just put out rubbish values git-svn-id: https://arducopter.googlecode.com/svn/trunk@2717 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- .../AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde b/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde index efd6beff56..f4aac4ca50 100644 --- a/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde +++ b/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde @@ -25,7 +25,10 @@ void setup() Serial.begin(115200); Serial.println("Compass library test (HMC5843 and HMC5883L)"); Wire.begin(); - compass.init(); // Initialization + if (!compass.init()) { + Serial.println("compass initialisation failed!"); + while (1) ; + } compass.set_orientation(AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD); // set compass's orientation on aircraft. compass.set_offsets(0,0,0); // set offsets to account for surrounding interference