From 53a2ee971270fcf759766a83496da05685ec8151 Mon Sep 17 00:00:00 2001 From: Ching-Kang Yen Date: Fri, 31 Jul 2020 02:04:51 +0800 Subject: common: implement body_detection state machine Implement body_detection state machine. Detect whether the user is close to the devices or not. Use the variance of acceleration from accelerometer to compute the motion confidence. If motion confidence is high enough, set the motion state to ON_BODY. If low enough, set it to OFF_BODY. Also, make gesture_cal() be called only when the gesture sensor data is updated. BRANCH=None BUG=b:123434029 TEST=make buildall, flash the ec, watch the ec console log Change-Id: If886b7f9fc505ef4db4d7abb08194b8f866121bb Signed-off-by: Ching-Kang Yen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2230938 Reviewed-by: Gwendal Grignou --- common/math_util.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'common/math_util.c') diff --git a/common/math_util.c b/common/math_util.c index 450dfbe5e7..dc52729c65 100644 --- a/common/math_util.c +++ b/common/math_util.c @@ -10,9 +10,6 @@ #include "math_util.h" #include "util.h" -/* Some useful math functions. Use with integers only! */ -#define SQ(x) ((x) * (x)) - /* For cosine lookup table, define the increment and the size of the table. */ #define COSINE_LUT_INCR_DEG 5 #define COSINE_LUT_SIZE ((180 / COSINE_LUT_INCR_DEG) + 1) -- cgit v1.2.1