summaryrefslogtreecommitdiff
path: root/test/test_config.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2018-12-17 15:14:00 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 17:27:00 -0700
commit40f9e2fc0f2354e033553131fd63cfb9f755a2e2 (patch)
tree1498d7190aece44697f3bee0e797565391f99750 /test/test_config.h
parent4a48404aeea58bfe0c31d5fea554b5329a223131 (diff)
downloadchrome-ec-40f9e2fc0f2354e033553131fd63cfb9f755a2e2.tar.gz
motion_lid: Rewrite lid angle calculation based on chromium code
Use code from ash/wm/tablet_mode/tablet_mode_controller.cc, in particular TabletModeController::HandleHingeRotation() to calculate lid angle. Add unit tests based on ash/wm/tablet_mode/tablet_mode_controller_unittest.cc and the data file accelerometer_test_data_literals.cc. BUG=b:120346412 BRANCH=none TEST=Check unit tests pass, check it compile on FPU based EC, EC without FPU and no 64 bit support (ampton). Check lid calculation is correct on eve: - with "while true ; do ectool motionsense lid_angle ; sleep 1 ; done" Check when hinge is almost vertical lid angle is close to constant or marked are unrieliable. Check when shaking device, lid angle is also unreliable Check with evtest SW_TABLET_MODE event is trigger when lid angle is available and cross 180 region. Change-Id: I545f7333ed9b53accedb75f238f747f66bae1f5d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1388844 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'test/test_config.h')
-rw-r--r--test/test_config.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/test_config.h b/test/test_config.h
index 12331461e6..b5f81f4e1e 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -66,7 +66,8 @@
#define CONFIG_MAG_CALIBRATE
#endif
-#ifdef TEST_MOTION_LID
+#if defined(TEST_MOTION_LID) || defined(TEST_MOTION_ANGLE) || \
+ defined(TEST_MOTION_ANGLE_TABLET)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 1
@@ -74,6 +75,19 @@
#define CONFIG_MOTION_FILL_LPC_SENSE_DATA
#endif
+#if defined(TEST_MOTION_ANGLE)
+#define CONFIG_ACCEL_FORCE_MODE_MASK \
+ ((1 << CONFIG_LID_ANGLE_SENSOR_BASE) | \
+ (1 << CONFIG_LID_ANGLE_SENSOR_LID))
+#define CONFIG_ACCEL_STD_REF_FRAME_OLD
+#endif
+
+#if defined(TEST_MOTION_ANGLE_TABLET)
+#define CONFIG_ACCEL_FORCE_MODE_MASK \
+ ((1 << CONFIG_LID_ANGLE_SENSOR_BASE) | \
+ (1 << CONFIG_LID_ANGLE_SENSOR_LID))
+#endif
+
#ifdef TEST_RMA_AUTH
/* Test server public and private keys */