summaryrefslogtreecommitdiff
path: root/test/motion_lid.c
diff options
context:
space:
mode:
authorphilipchen <philipchen@google.com>2017-03-14 17:40:49 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-03-17 20:12:23 -0700
commit7814f3319e7331ae9f3313d2a04e14b0bc1f1a90 (patch)
treef4b703508cee133a111c0620763af54db1615b1e /test/motion_lid.c
parent80cb93f45d396d797a47ab478dd62f9d29be7b3b (diff)
downloadchrome-ec-7814f3319e7331ae9f3313d2a04e14b0bc1f1a90.tar.gz
motion_lid: no angle correction when lid close
BUG=b:36107214 BRANCH=gru TEST=manually on kevin: (1) make DUT in tablet mode (2) swiftly close the lid (3) check ec log and confirm DUT can read small angle and turn into clamshell mode when lid is closed. TEST=make runtests Change-Id: I7ebf10d38a8b300960ebf46be717d48522c6fd0b Reviewed-on: https://chromium-review.googlesource.com/455458 Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 75ba9147c392367037c21e79899f463c32c1f92f) Reviewed-on: https://chromium-review.googlesource.com/457137 Commit-Ready: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'test/motion_lid.c')
-rw-r--r--test/motion_lid.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/motion_lid.c b/test/motion_lid.c
index dfea3ecf91..bed03379ff 100644
--- a/test/motion_lid.c
+++ b/test/motion_lid.c
@@ -316,6 +316,20 @@ static int test_lid_angle(void)
wait_for_valid_sample();
TEST_ASSERT(motion_lid_get_angle() == LID_ANGLE_UNRELIABLE);
+ /*
+ * Open the lid to 350, and then close the lid and set the angle
+ * to 10. The reading of small angle shouldn't be corrected.
+ */
+ gpio_set_level(GPIO_LID_OPEN, 1);
+ msleep(100);
+ gpio_set_level(GPIO_LID_OPEN, 0);
+ msleep(100);
+ lid->xyz[X] = 0;
+ lid->xyz[Y] = 173;
+ lid->xyz[Z] = -984;
+ wait_for_valid_sample();
+ TEST_ASSERT(motion_lid_get_angle() == 10);
+
return EC_SUCCESS;
}