From 26a8c75a843cc34e2219f9020695730dad7c1415 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 Jul 2018 10:42:59 +1000 Subject: [PATCH] AP_Compass: clear DEV_ID for undetected compasses this prevents user confusion with the number of compasses detected --- libraries/AP_Compass/AP_Compass.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index fb2016e8e6..e16d5482b9 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -477,6 +477,14 @@ Compass::init() hal.scheduler->delay(100); read(); } + // set the dev_id to 0 for undetected compasses, to make it easier + // for users to see how many compasses are detected. We don't do a + // set_and_save() as the user may have temporarily removed the + // compass, and we don't want to force a re-cal if they plug it + // back in again + for (uint8_t i=_compass_count; i