diff options
author | Brian Norris <briannorris@chromium.org> | 2016-07-28 10:53:59 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-28 20:20:19 -0700 |
commit | 43b2f5bac6ba31265e1a25c4417bc108cf79e3ef (patch) | |
tree | 5162054fef8416f166b2a78379de3698d1f06376 | |
parent | dcf9d709df927c8c5b9ae8d2bd35c40d5b6cedc9 (diff) | |
download | chrome-ec-43b2f5bac6ba31265e1a25c4417bc108cf79e3ef.tar.gz |
kevin: invert accelerometer matrix
We have the lid and base sensors correct in relation to each other.
e.g., when at 90 degree lid angle, this reports correctly:
# ectool motionsense lid_angle
Lid angle: 90
But it appears that our axes are opposite from (e.g.) what Chrome
expects. With the lid angle at 180 degrees flat on a desk, I see:
# ectool motionsense
Motion sensing inactive
Sensor 0: -571 1018 -16302
Sensor 1: 0 0 0
Sensor 2: 896 -3424 -16208
but the Z-axis should be positive. After this patch, I see:
# ectool motionsense
Motion sensing inactive
Sensor 0: 580 -1000 16289
Sensor 1: 0 0 0
Sensor 2: -832 16368 1008
Which looks more accurate, and actually gets Chrome to rotate properly.
All tested on kevin rev3.
BRANCH=none
BUG=chrome-os-partner:55717
TEST=`ectool motionsense`, `ectool motionsense lid_angle`; also test
rotation in Chrome
Change-Id: Ie1bffe27989c893d6037e251499f235ef10d4578
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364161
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/kevin/board.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/board/kevin/board.c b/board/kevin/board.c index 195b80f17a..d5ca8a4e84 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -406,15 +406,15 @@ struct bma2x2_accel_data g_bma255_data = { /* Matrix to rotate accelrator into standard reference frame */ const matrix_3x3_t base_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} + { 0, FLOAT_TO_FP(1), 0}, + { FLOAT_TO_FP(1), 0, 0}, + { 0, 0, FLOAT_TO_FP(-1)} }; const matrix_3x3_t lid_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} + { 0, FLOAT_TO_FP(1), 0}, + { FLOAT_TO_FP(-1), 0, 0}, + { 0, 0, FLOAT_TO_FP(1)} }; #endif |