OSDN Git Service

Shift gyro drop count from common.h to filtering.h
authorPatrick Porlan <patrick.porlan@intel.com>
Fri, 21 Nov 2014 08:47:35 +0000 (09:47 +0100)
committerGerrit Code Review <gerrit@mcg-psi-gcr1.jf.intel.com>
Fri, 21 Nov 2014 14:58:41 +0000 (06:58 -0800)
Also, rename it with a more specific name.

Change-Id: Id87ad267b25949699cc29dcdd4cac28a5d572fbb
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
common.h
filtering.h
transform.c

index 477707c..977d810 100644 (file)
--- a/common.h
+++ b/common.h
@@ -32,8 +32,6 @@
 
 #define MAX_NAME_SIZE          32
 
-#define MIN_SAMPLES 5
-
 #define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0])
 #define REPORTING_MODE(x)      ((x) & 0x06)
 
index fda84e6..e899202 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef FILTERING_H
 #define FILTERING_H
 
+#define        GYRO_MIN_SAMPLES 5 /* Drop first few gyro samples after enable */
+
 void setup_noise_filtering             (int s);
 void release_noise_filtering_data      (int s);
 void denoise                           (int s, struct sensors_event_t* event);
index 42b3e3a..733c976 100644 (file)
@@ -289,15 +289,15 @@ static int finalize_sample_default (int s, struct sensors_event_t* data)
                                sensor_info[s].motion_trigger_name)
                                        calibrate_gyro(data, &sensor_info[s]);
 
-                       /* For noisy sensors we'll drop a very few number
-                        * of samples to make sure we have at least MIN_SAMPLES events
-                        * in the filtering queue. This is to make sure we are not sending
-                        * events that can disturb our mean or stddev.
+                       /*
+                        * For noisy sensors drop a few samples to make sure we
+                        * have at least GYRO_MIN_SAMPLES events in the
+                        * filtering queue. This improves mean and std dev.
                         */
                        if (sensor_info[s].quirks & QUIRK_NOISY) {
-                               if((sensor_info[s].selected_trigger !=
-                                       sensor_info[s].motion_trigger_name) &&
-                                       sensor_info[s].event_count < MIN_SAMPLES)
+                               if (sensor_info[s].selected_trigger !=
+                                   sensor_info[s].motion_trigger_name &&
+                                   sensor_info[s].event_count<GYRO_MIN_SAMPLES)
                                                return 0;
 
                                denoise(s, data);