From 79deeef0a0b5cf5f64778fa17834611d89ad7f19 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <tridge@samba.org>
Date: Wed, 28 Mar 2012 22:40:32 +1100
Subject: [PATCH] Compass: added some more comments

explain the algorithm a bit more
---
 libraries/AP_Compass/Compass.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libraries/AP_Compass/Compass.cpp b/libraries/AP_Compass/Compass.cpp
index 4f485b270..a0a294a65 100644
--- a/libraries/AP_Compass/Compass.cpp
+++ b/libraries/AP_Compass/Compass.cpp
@@ -250,7 +250,12 @@ Compass::null_offsets(void)
     length = diff.length();
     if (length < min_diff) {
         // the mag vector hasn't changed enough - we don't get
-        // enough information from this vector to use it
+        // enough information from this vector to use it.
+        // Note that we don't put the current vector into the mag
+        // history here. We want to wait for a larger rotation to
+        // build up before calculating an offset change, as accuracy
+        // of the offset change is highly dependent on the size of the
+        // rotation.
         _mag_history_index = (_mag_history_index + 1) % _mag_history_size;
         return;
     }
-- 
GitLab