diff options
-rw-r--r-- | common/gesture.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/common/gesture.c b/common/gesture.c index 278e74e980..d8b3383319 100644 --- a/common/gesture.c +++ b/common/gesture.c @@ -147,10 +147,15 @@ static int gesture_tap_for_battery(void) y_p = y; z_p = z; - /* Ignore data until we fill history buffer and wrap around */ - if (history_idx == 0) + /* + * Ignore data until we fill history buffer and wrap around. If + * detection is paused, history_init_index will store the index + * when paused, so that when re-started, we will wait until we + * wrap around again. + */ + if (history_idx == history_init_index) history_initialized = 1; - if (history_initialized == history_init_index) + if (!history_initialized) return 0; /* |