summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/motion_lid.c27
-rw-r--r--test/test_config.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/test/motion_lid.c b/test/motion_lid.c
index 26eff7f1a4..f610250e9c 100644
--- a/test/motion_lid.c
+++ b/test/motion_lid.c
@@ -230,6 +230,33 @@ static int test_lid_angle(void)
wait_for_valid_sample();
TEST_ASSERT(motion_lid_get_angle() == 225);
+ /* Set lid open to 350 */
+ lid->xyz[X] = 0;
+ lid->xyz[Y] = -173;
+ lid->xyz[Z] = -984;
+ wait_for_valid_sample();
+ TEST_ASSERT(motion_lid_get_angle() == 350);
+
+ /* Set lid open to 10, check rotation did not change. */
+ lid->xyz[X] = 0;
+ lid->xyz[Y] = 173;
+ lid->xyz[Z] = -984;
+ wait_for_valid_sample();
+ TEST_ASSERT(motion_lid_get_angle() == 350);
+
+ /* Rotate back to 180 and then 10 */
+ lid->xyz[X] = 0;
+ lid->xyz[Y] = 0;
+ lid->xyz[Z] = 1000;
+ wait_for_valid_sample();
+ TEST_ASSERT(motion_lid_get_angle() == 180);
+
+ lid->xyz[X] = 0;
+ lid->xyz[Y] = 173;
+ lid->xyz[Z] = -984;
+ wait_for_valid_sample();
+ TEST_ASSERT(motion_lid_get_angle() == 10);
+
/*
* Align base with hinge and make sure it returns unreliable for angle.
* In this test it doesn't matter what the lid acceleration vector is.
diff --git a/test/test_config.h b/test/test_config.h
index dacfe04868..ffb8e877f4 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -44,6 +44,7 @@
#ifdef TEST_MOTION_LID
#define CONFIG_LID_ANGLE
+#define CONFIG_LID_ANGLE_INVALID_CHECK
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 1
#endif