summaryrefslogtreecommitdiff
path: root/common/online_calibration.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-03-09 11:41:00 -0600
committerCommit Bot <commit-bot@chromium.org>2020-03-12 00:09:33 +0000
commit47bd81774313e37af925d468d3b943b66a9268fc (patch)
tree95ceeefee220f256687e0c2518839d8aca7dedee /common/online_calibration.c
parent0527410e89475282c9d74cb7176cafa8528aad89 (diff)
downloadchrome-ec-47bd81774313e37af925d468d3b943b66a9268fc.tar.gz
common: online_calibration: Initialize accelerometer calibration
Update the init function for online calibration to initialize the accelerometer calibration. BRANCH=None BUG=b:138303429,chromium:1023858 TEST=build Change-Id: I01c353830edb4b7508e6614dcebbceffee41690f Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2095518 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common/online_calibration.c')
-rw-r--r--common/online_calibration.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/common/online_calibration.c b/common/online_calibration.c
index 519b1be8e3..dd2c154260 100644
--- a/common/online_calibration.c
+++ b/common/online_calibration.c
@@ -93,8 +93,29 @@ void online_calibration_init(void)
{
size_t i;
- for (i = 0; i < SENSOR_COUNT; i++)
- motion_sensors[i].online_calib_data->last_temperature = -1;
+ for (i = 0; i < SENSOR_COUNT; i++) {
+ struct motion_sensor_t *s = motion_sensors + i;
+ void *type_specific_data = NULL;
+
+ if (s->online_calib_data) {
+ s->online_calib_data->last_temperature = -1;
+ type_specific_data =
+ s->online_calib_data->type_specific_data;
+ }
+
+ if (!type_specific_data)
+ continue;
+
+ switch (s->type) {
+ case MOTIONSENSE_TYPE_ACCEL: {
+ accel_cal_reset((struct accel_cal *)
+ type_specific_data);
+ break;
+ }
+ default:
+ break;
+ }
+ }
}
bool online_calibration_has_new_values(void)