summaryrefslogtreecommitdiff
path: root/include/accel_cal.h
Commit message (Collapse)AuthorAgeFilesLines
* common: online_calibration: Fire MKBP event on new calibrationYuval Peress2020-03-091-0/+1
| | | | | | | | | | | | | | Implement online calibration for accelerometers and fire a new MKBP event when a new calibration value is computed. TEST=Added new unit tests BRANCH=None BUG=b:138303429,chromium:1023858 Change-Id: I31ec7164be0d8c7dac210a1ac4b94ec9ecd6a60a Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2012847 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: Implement accelerometer calibrationYuval Peress2020-02-081-0/+51
This change implements the hybrid accelerometer calibration algorithm described in https://drive.google.com/corp/drive/u/0/folders/13k8AWvVkCg8KUr1HhD2qv6_ob1ixgCbE 1. Waits until the device is still 2. Adds a still sample to an orientation accumulator - If the new sample is close to an existing one, they're merged. - If the new sample is unique, it is added to the list of orientations in a FIFO manner (may be evicting an older sample). - Once enough orientations have been gathered, run the kasa algorithm. - The kasa algorithm should yield a radius that's near 1g, since all the samples were added when still. If this isn't the case, we fall back on newton's method (which takes longer). BUG=b:138303429,chromium:1023858 BRANCH=None TEST=buildall with new unit tests Change-Id: I98bb0d365017d8a916b008c7c0c263345a9cddac Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879716 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>