summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-12-29 18:43:46 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-30 22:04:11 +0000
commitae82f824abcd6cd0444034feb6a10c09f8f5e61d (patch)
treec0dd0c2dc0e00b37a87333dc97e58329479a19b5
parent9d25fa90061fecbbd34ab9be57be424ad1da1498 (diff)
downloadchrome-ec-ae82f824abcd6cd0444034feb6a10c09f8f5e61d.tar.gz
gesture: add absolute threshold for start of tap for battery
Add absolute threshold on delta_z_inner for tap for battery to guarantee that we have at least some minimum absolute change in z that has started the tap for battery. This change makes it such that if the accel readings are really steady for a while, then a sudden noisy signal doesn't trigger tap for battery. BUG=chrome-os-partner:34592 BRANCH=samus TEST=use tapinfo on to observe tap values and do a double tap of varying intensities. note that it should be just a little less sensitive to weak taps. Change-Id: I95367bc7f99b888e15e9ac3a2bc8c9cca32d30d6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237666 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--common/gesture.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/gesture.c b/common/gesture.c
index 9fc1e33e22..5c79d04097 100644
--- a/common/gesture.c
+++ b/common/gesture.c
@@ -176,7 +176,8 @@ static int gesture_tap_for_battery(void)
switch (state) {
case TAP_IDLE:
/* Look for a sudden increase in Z movement */
- if (delta_z_inner > 13 * delta_z_outer &&
+ if (delta_z_inner > 30000 &&
+ delta_z_inner > 13 * delta_z_outer &&
delta_z_inner > 1 * delta_xy_inner) {
delta_z_inner_max = delta_z_inner;
state_cnt = 0;