From a86b4b0a782cb7614969676b00f8b136c825aab7 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Fri, 24 Oct 2014 15:48:57 -0700 Subject: [PATCH] gesture: Minor fixes Set state or numeric when needed Add debug for the idle state. BUG=None BRANCH=ToT TEST=Check debug appears when enabled. Check tap still works. Change-Id: Ic4660f70a27464dc68c02fdaef60dc36d7c2edad Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/225487 Reviewed-by: Alec Berg Reviewed-by: Sheng-liang Song --- common/gesture.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/gesture.c b/common/gesture.c index 865309c301..6c5572cd44 100644 --- a/common/gesture.c +++ b/common/gesture.c @@ -180,7 +180,7 @@ static int gesture_tap_for_battery(void) if (delta_z_inner > 13 * delta_z_outer && delta_z_inner > 1 * delta_xy_inner) { delta_z_inner_max = delta_z_inner; - state_cnt = TAP_IDLE; + state_cnt = 0; state = TAP_IMPULSE_1; } break; @@ -254,7 +254,9 @@ static int gesture_tap_for_battery(void) } /* On state transitions, print debug info */ - if (state != state_p && tap_debug) { + if (tap_debug && + (state != state_p || + (state_cnt % 10000 == 9999))) { /* make sure we don't divide by 0 */ if (delta_z_outer == 0 || delta_xy_inner == 0) CPRINTS("tap st %d->%d, error div by 0", @@ -291,7 +293,7 @@ static void gesture_chipset_suspend(void) * record a whole new set of data, and enable tap detection */ history_initialized = 0; - state = 0; + state = TAP_IDLE; history_idx = 0; tap_detection = 1; }