From db7e7fbf95949cea64e6e0f755bafef4198d240d Mon Sep 17 00:00:00 2001 From: Patrick Porlan Date: Wed, 15 Oct 2014 11:32:36 +0200 Subject: [PATCH] IRDA-2056: Fix accuracy indicator for gyroscope readings. Report medium accuracy rather than the default (unreliable) one if we're not using calibration. Change-Id: I648075681eed0a82bc081babe8a0825096bbe4a4 --- gyro-calibration.c | 2 -- transform.c | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gyro-calibration.c b/gyro-calibration.c index a9aa92c..cfdac9d 100644 --- a/gyro-calibration.c +++ b/gyro-calibration.c @@ -84,8 +84,6 @@ void calibrate_gyro(struct sensors_event_t* event, struct sensor_info_t* info) { struct gyro_cal* cal_data = (struct gyro_cal*) info->cal_data; - event->gyro.status = SENSOR_STATUS_ACCURACY_MEDIUM; - if (cal_data == NULL) return; diff --git a/transform.c b/transform.c index 1993169..7aebae8 100644 --- a/transform.c +++ b/transform.c @@ -286,6 +286,13 @@ static int finalize_sample_default(int s, struct sensors_event_t* data) case SENSOR_TYPE_GYROSCOPE: case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED: + /* + * Report medium accuracy by default ; higher accuracy + * levels will be reported once, and if, we achieve + * calibration. + */ + data->gyro.status = SENSOR_STATUS_ACCURACY_MEDIUM; + if (!(sensor_info[s].quirks & QUIRK_TERSE_DRIVER)) calibrate_gyro(data, &sensor_info[s]); if (sensor_info[s].quirks & QUIRK_NOISY) -- 2.11.0