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>
This commit is contained in:
Alec Berg
2014-12-29 18:43:46 -08:00
committed by chrome-internal-fetch
parent 9d25fa9006
commit ae82f824ab

View File

@@ -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;