diff options
author | Jinkyu Song <jksong@sta.samsung.com> | 2011-10-14 20:27:46 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-10-15 22:36:53 -0700 |
commit | 76c7c028ba3f0eeb17b7cf4709883ace0ffc83c5 (patch) | |
tree | 159635e29330c94fe4eb9e780350b4fe75ba3ff9 | |
parent | 7f7785f89f4e04c27f0bb6cb11776778305f3c39 (diff) | |
download | invensense-ics-mr0-release.tar.gz |
SensorHAL: Reset compass calibrationandroid-sdk-adt_r16.0.1android-cts-4.0_r1android-4.0.2_r1android-4.0.1_r1.2android-4.0.1_r1.1android-4.0.1_r1ics-mr0-releaseics-mr0ics-factoryrom-2-release
If compass calibration is not achieved for 10 seconds,
it starts over the whole calibration process.
Change-Id: Id362542985b464d10c99fa49ca465b1892ea5c5a
Signed-off-by: Jinkyu Song <jksong@sta.samsung.com>
-rw-r--r-- | mlsdk/mllite/mlsupervisor.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mlsdk/mllite/mlsupervisor.c b/mlsdk/mllite/mlsupervisor.c index 017907f..139297f 100644 --- a/mlsdk/mllite/mlsupervisor.c +++ b/mlsdk/mllite/mlsupervisor.c @@ -61,6 +61,8 @@ static int accCount = 0; static int compassCalStableCount = 0; static int compassCalCount = 0; static int coiltimerstart = 0; +static unsigned long disturbtime = 0; +static int disturbtimerstart = 0; static yas_filter_if_s f; static yas_filter_handle_t handle; @@ -425,6 +427,16 @@ inv_error_t inv_accel_compass_supervisor(void) (long) (tmp64 / inv_obj.compass_sens); } //Additions: + if ((inv_obj.compass_state == 1) && + (inv_obj.compass_overunder == 0)) { + if (disturbtimerstart == 0) { + disturbtimerstart = 1; + disturbtime = ctime; + } + } else { + disturbtimerstart = 0; + } + if (inv_obj.compass_overunder) { if (coiltimerstart == 0) { coiltimerstart = 1; @@ -439,6 +451,16 @@ inv_error_t inv_accel_compass_supervisor(void) coiltimerstart = 0; } } + + if (disturbtimerstart == 1) { + if (ctime - disturbtime > 10000) { + inv_obj.flags[INV_COMPASS_OFFSET_VALID] = 0; + inv_set_compass_offset(); + inv_reset_compass_calibration(); + MPL_LOGI("Compass reset! inv_reset_compass_calibration \n"); + disturbtimerstart = 0; + } + } } if (inv_obj.external_slave_callback) { result = inv_obj.external_slave_callback(&inv_obj); |