diff options
author | reno.wang <reno.wang@lcfc.corp-partner.google.com> | 2021-10-27 19:28:52 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-19 18:36:51 +0000 |
commit | bcb2512bc7c4e22433809dd8b9f5d1d1a909a5f6 (patch) | |
tree | 2e0598770b402d301afd15fa2b9fca7ca11dae96 | |
parent | 066712fc872f66a42fec2566ecd2910cd21d102e (diff) | |
download | chrome-ec-bcb2512bc7c4e22433809dd8b9f5d1d1a909a5f6.tar.gz |
taeko: Calibrate the orientation matrix
BUG=b:201504044
BRANCH=None
TEST=make -j BOARD=taeko, check x, y, z axis of sensor 1 and 2 via
ectool motionsense.
Signed-off-by: reno.wang <reno.wang@lcfc.corp-partner.google.com>
Change-Id: I04f411f188a276adfe1c44b9f7eb644bc94df4aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3247510
Reviewed-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Commit-Queue: YH Lin <yueherngl@chromium.org>
-rw-r--r-- | board/taeko/sensors.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/board/taeko/sensors.c b/board/taeko/sensors.c index b5d75460fe..2643da35aa 100644 --- a/board/taeko/sensors.c +++ b/board/taeko/sensors.c @@ -67,21 +67,18 @@ static struct accelgyro_saved_data_t g_bma422_data; static struct lsm6dso_data lsm6dso_data; static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; -/* TODO(b/201504044): calibrate the orientation matrix on later board stage */ -#if 0 +/* (b/201504044): calibrate the orientation matrix on later board stage */ static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} + { FLOAT_TO_FP(-1), 0, 0}, + { 0, 0, FLOAT_TO_FP(1)} }; static const mat33_fp_t base_standard_ref = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} + { FLOAT_TO_FP(-1), 0, 0}, + { 0, 0, FLOAT_TO_FP(-1)}, + { 0, FLOAT_TO_FP(-1), 0} }; -#endif - struct motion_sensor_t bma422_lid_accel = { .name = "Lid Accel - BMA", @@ -94,7 +91,7 @@ struct motion_sensor_t bma422_lid_accel = { .drv_data = &g_bma422_data, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY, /* 0x18 */ - .rot_standard_ref = NULL, /* identity matrix */ + .rot_standard_ref = &lid_standard_ref, /* identity matrix */ .default_range = 2, /* g, enough for laptop. */ .min_frequency = BMA4_ACCEL_MIN_FREQ, .max_frequency = BMA4_ACCEL_MAX_FREQ, @@ -126,7 +123,7 @@ struct motion_sensor_t lsm6dsm_base_accel = { .flags = MOTIONSENSE_FLAG_INT_SIGNAL, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .min_frequency = LSM6DSM_ODR_MIN_VAL, .max_frequency = LSM6DSM_ODR_MAX_VAL, @@ -158,7 +155,7 @@ struct motion_sensor_t lsm6dsm_base_gyro = { .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, .default_range = 1000 | ROUND_UP_FLAG, /* dps */ - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .min_frequency = LSM6DSM_ODR_MIN_VAL, .max_frequency = LSM6DSM_ODR_MAX_VAL, }; @@ -177,7 +174,7 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LIS2DW12_ADDR1, /* 0x19 */ .flags = MOTIONSENSE_FLAG_INT_SIGNAL, - .rot_standard_ref = NULL, /* identity matrix */ + .rot_standard_ref = &lid_standard_ref, /* identity matrix */ .default_range = 2, /* g */ .min_frequency = LIS2DW12_ODR_MIN_VAL, .max_frequency = LIS2DW12_ODR_MAX_VAL, @@ -206,7 +203,7 @@ struct motion_sensor_t motion_sensors[] = { .flags = MOTIONSENSE_FLAG_INT_SIGNAL, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS, - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g */ .min_frequency = LSM6DSO_ODR_MIN_VAL, .max_frequency = LSM6DSO_ODR_MAX_VAL, @@ -236,7 +233,7 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS, .default_range = 1000 | ROUND_UP_FLAG, /* dps */ - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .min_frequency = LSM6DSO_ODR_MIN_VAL, .max_frequency = LSM6DSO_ODR_MAX_VAL, }, |