summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInno Park <ih.yoo.park@samsung.com>2018-05-18 17:07:55 +0900
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-06-08 04:56:05 +0000
commitaa77a8c5ecd554b55c86be2f3f17d8afc490efd4 (patch)
tree7232dfacfe968dfc2f7c5ae154b60f195f5b6c27
parent29071d2577c99a8a1cb9489ec11a70e6c22d4ab7 (diff)
downloadchrome-ec-aa77a8c5ecd554b55c86be2f3f17d8afc490efd4.tar.gz
nautilus: change the reference value, NOISY_MAGNITUDE_DEVIATION
Changed NOISY_MAGNITUDE_DEVIATION from 1 to 1.5. Current value seems to be set too low. So ec could regard lid angle as unreliable even when sensors are at rest. BUG=b:79670788 BRANCH=firmware-poppy-10431.B TEST=Build & flash EC then ectool motionsense Change-Id: I07c3e5c2149e7dade567592a437d36d3a294b7af Signed-off-by: Inno Park <ih.yoo.park@samsung.com> Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1065954 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Ih-Yoo Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-by: Ih-Yoo Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Ih-Yoo Park <ih.yoo.park@samsung.corp-partner.google.com>
-rw-r--r--board/nautilus/board.h10
-rw-r--r--common/motion_lid.c20
-rw-r--r--include/config.h9
3 files changed, 24 insertions, 15 deletions
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 74eced7a49..31c48f9b75 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -126,7 +126,15 @@
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_TABLET_MODE
#define CONFIG_LID_ANGLE_INVALID_CHECK
-/* Lower maximal ODR to 100Hz */
+/*
+ * Workound for b/79670788.
+ *
+ * Be more lenient when determining valid lid angles.
+ */
+#undef CONFIG_NOISY_MAGNITUDE_DEVIATION
+#define CONFIG_NOISY_MAGNITUDE_DEVIATION FLOAT_TO_FP(1.5)
+
+/* Lower maximal ODR to 100Hz. */
#define CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ 100000
/* FIFO size is in power of 2. */
diff --git a/common/motion_lid.c b/common/motion_lid.c
index 38efea172e..a7c9f13f3b 100644
--- a/common/motion_lid.c
+++ b/common/motion_lid.c
@@ -105,15 +105,6 @@ static int lid_angle_is_reliable;
#define DEBOUNCE_ANGLE_DELTA FLOAT_TO_FP(45)
/*
- * Since the accelerometers are on the same physical device, they should be
- * under the same acceleration. This constant, which mirrors
- * kNoisyMagnitudeDeviation used in Chromium, is an integer which defines the
- * maximum deviation in magnitude between the base and lid vectors. The units
- * are in m/s^2.
- */
-#define NOISY_MAGNITUDE_DEVIATION 1
-
-/*
* Define the accelerometer orientation matrices based on the standard
* reference frame in use (note: accel data is converted to standard ref
* frame before calculating lid angle).
@@ -280,8 +271,9 @@ static int calculate_lid_angle(const vector_3_t base, const vector_3_t lid,
scaled_lid[Z] * scaled_lid[Z]) >> 6;
/*
- * Check to see if they differ than more than NOISY_MAGNITUDE_DEVIATION.
- * If the vectors do, then the measured angle is unreliable.
+ * Check to see if they differ than more than
+ * CONFIG_NOISY_MAGNITUDE_DEVIATION. If the vectors do, then the
+ * measured angle is unreliable.
*
* Note, that we don't actually have to take the square root to get the
* magnitude, but we can work with the magnitudes squared directly as
@@ -297,10 +289,10 @@ static int calculate_lid_angle(const vector_3_t base, const vector_3_t lid,
* If we assume that the average acceleration should be about 1g, then
* we have:
*
- * (A^2 - B^2) < 2 * 1g * NOISY_MAGNITUDE_DEVIATION
+ * (A^2 - B^2) < 2 * 1g * CONFIG_NOISY_MAGNITUDE_DEVIATION
*/
- if (ABS(base_magnitude2 - lid_magnitude2) >
- (2 * 10 * NOISY_MAGNITUDE_DEVIATION))
+ if (FLOAT_TO_FP(ABS(base_magnitude2 - lid_magnitude2)) >
+ FLOAT_TO_FP(2 * 10 * CONFIG_NOISY_MAGNITUDE_DEVIATION))
reliable = 0;
#ifdef CONFIG_LID_ANGLE_INVALID_CHECK
diff --git a/include/config.h b/include/config.h
index 5bf4f302bc..c8980a9aaf 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2126,6 +2126,15 @@
/* Do not try hold I/O pins at frozen level during deep sleep */
#undef CONFIG_NO_PINHOLD
+/*
+ * Since the accelerometers are on the same physical device, they should be
+ * under the same acceleration. This constant, which mirrors
+ * kNoisyMagnitudeDeviation used in Chromium, is an integer, 1, which defines
+ * the maximum deviation in magnitude between the base and lid vectors. The
+ * units are in m/s^2.
+ */
+#define CONFIG_NOISY_MAGNITUDE_DEVIATION FLOAT_TO_FP(1)
+
/* Support one-wire interface */
#undef CONFIG_ONEWIRE