OSDN Git Service

IRDA-2056: Refine the test we use to decide to apply gyro calibration
authorPatrick Porlan <patrick.porlan@intel.com>
Wed, 15 Oct 2014 12:03:24 +0000 (14:03 +0200)
committerAdriana Reus <adriana.reus@intel.com>
Tue, 21 Oct 2014 13:27:04 +0000 (16:27 +0300)
The terse flag should only be used with drivers that a) don't
expose a recognizable motion trigger (we currently look for the
any-motion substring), b) are not for sensor types that Android
defines as continuous, and c) are nonetheless on-change. As of
today the only remaining example of this that I can think of
are the XPS 12 ISH drivers, so I prefer not to use this flag
to decide whether or not to apply calibration. Checking whether
we're using the initial or motion trigger seems better, if not
fully satisfactory.

Change-Id: I24c6632497f758e1301da7927ec94bf17f6fe84d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
transform.c

index 7aebae8..78ec500 100644 (file)
@@ -293,8 +293,16 @@ static int finalize_sample_default(int s, struct sensors_event_t* data)
                         */
                        data->gyro.status = SENSOR_STATUS_ACCURACY_MEDIUM;
 
-                       if (!(sensor_info[s].quirks & QUIRK_TERSE_DRIVER))
-                               calibrate_gyro(data, &sensor_info[s]);
+                       /*
+                        * We're only trying to calibrate data from continuously
+                        * firing gyroscope drivers, as motion based ones use
+                        * movement thresholds that may lead us to incorrectly
+                        * estimate bias.
+                        */
+                       if (sensor_info[s].selected_trigger !=
+                               sensor_info[s].motion_trigger_name)
+                                       calibrate_gyro(data, &sensor_info[s]);
+
                        if (sensor_info[s].quirks & QUIRK_NOISY)
                                denoise_median(&sensor_info[s], data, 3);
                        break;