diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-06-27 15:21:52 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-28 10:00:11 +0000 |
commit | 0d25ee0c10b7de65f6cf351a6ebe36876aea1cbe (patch) | |
tree | d873cb30c96c0cd776b2fc97a4835fcf9838cb53 /test/online_calibration.c | |
parent | 06ba0ecfa632ef1882618a942af31fc48924738f (diff) | |
download | chrome-ec-0d25ee0c10b7de65f6cf351a6ebe36876aea1cbe.tar.gz |
test/online_calibration.c: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: Iceeab0d9294d27707635d01ea04a51216224e9cc
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730516
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'test/online_calibration.c')
-rw-r--r-- | test/online_calibration.c | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/test/online_calibration.c b/test/online_calibration.c index 1b3abf51bc..8a9215caa3 100644 --- a/test/online_calibration.c +++ b/test/online_calibration.c @@ -48,17 +48,14 @@ static struct accelgyro_drv mock_sensor_driver = { .read_temp = mock_read_temp, }; -static struct accel_cal_algo base_accel_cal_algos[] = { - { - .newton_fit = NEWTON_FIT(4, 15, FLOAT_TO_FP(0.01f), - FLOAT_TO_FP(0.25f), - FLOAT_TO_FP(1.0e-8f), 100), - } -}; +static struct accel_cal_algo base_accel_cal_algos[] = { { + .newton_fit = NEWTON_FIT(4, 15, FLOAT_TO_FP(0.01f), FLOAT_TO_FP(0.25f), + FLOAT_TO_FP(1.0e-8f), 100), +} }; static struct accel_cal base_accel_cal_data = { - .still_det = STILL_DET(FLOAT_TO_FP(0.00025f), 800 * MSEC, 1200 * MSEC, - 5), + .still_det = + STILL_DET(FLOAT_TO_FP(0.00025f), 800 * MSEC, 1200 * MSEC, 5), .algos = base_accel_cal_algos, .num_temp_windows = ARRAY_SIZE(base_accel_cal_algos), }; @@ -68,9 +65,8 @@ static struct mag_cal_t lid_mag_cal_data; static bool next_accel_cal_accumulate_result; static fpv3_t next_accel_cal_bias; -bool accel_cal_accumulate( - struct accel_cal *cal, uint32_t sample_time, fp_t x, fp_t y, fp_t z, - fp_t temp) +bool accel_cal_accumulate(struct accel_cal *cal, uint32_t sample_time, fp_t x, + fp_t y, fp_t z, fp_t temp) { if (next_accel_cal_accumulate_result) { cal->bias[X] = next_accel_cal_bias[X]; @@ -110,8 +106,8 @@ static int test_read_temp_on_stage(void) mock_read_temp_results = &expected; data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[0], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); TEST_EQ(expected.used_count, 1, "%d"); @@ -128,12 +124,12 @@ static int test_read_temp_from_cache_on_stage(void) mock_read_temp_results = &expected; data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[0], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[0], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); TEST_EQ(expected.used_count, 1, "%d"); @@ -150,13 +146,13 @@ static int test_read_temp_twice_after_cache_stale(void) mock_read_temp_results = &expected; data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[0], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); sleep(2); - rc = online_calibration_process_data( - &data, &motion_sensors[0], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[0], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); TEST_EQ(expected.used_count, 2, "%d"); @@ -176,17 +172,17 @@ static int test_new_calibration_value(void) next_accel_cal_accumulate_result = false; data.sensor_num = BASE; - rc = online_calibration_process_data( - &data, &motion_sensors[BASE], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[BASE], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); TEST_EQ(online_calibration_has_new_values(), false, "%d"); next_accel_cal_accumulate_result = true; - next_accel_cal_bias[X] = 0.01f; /* expect: 81 */ - next_accel_cal_bias[Y] = -0.02f; /* expect: -163 */ - next_accel_cal_bias[Z] = 0; /* expect: 0 */ - rc = online_calibration_process_data( - &data, &motion_sensors[BASE], __hw_clock_source_read()); + next_accel_cal_bias[X] = 0.01f; /* expect: 81 */ + next_accel_cal_bias[Y] = -0.02f; /* expect: -163 */ + next_accel_cal_bias[Z] = 0; /* expect: 0 */ + rc = online_calibration_process_data(&data, &motion_sensors[BASE], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); TEST_EQ(online_calibration_has_new_values(), true, "%d"); @@ -216,8 +212,8 @@ int test_mag_reading_updated_cal(void) init_mag_cal(&expected_results); mag_cal_update(&expected_results, test_values); - rc = online_calibration_process_data( - &data, &motion_sensors[LID], __hw_clock_source_read()); + rc = online_calibration_process_data(&data, &motion_sensors[LID], + __hw_clock_source_read()); TEST_EQ(rc, EC_SUCCESS, "%d"); TEST_EQ(expected_results.kasa_fit.nsamples, lid_mag_cal_data.kasa_fit.nsamples, "%d"); |