OSDN Git Service

Min/Max delay for Light and Temperature
[android-x86/hardware-intel-libsensors.git] / calibration.h
index 052998c..6275ad3 100644 (file)
@@ -9,21 +9,12 @@
 
 /* compass defines */
 #define COMPASS_CALIBRATION_PATH "/data/compass.conf"
-#define DS_SIZE 48
+#define DS_SIZE 32
 #define EPSILON 0.000000001
+#define CAL_STEPS 4
 
-
-/* If no cal data is present - first calibration will
-   use a more relaxed set of values to get an initial
-   calibration faster */
-#define FIRST_MIN_DIFF 0.5f
-#define FIRST_MAX_SQR_ERR 5.0f
-#define FIRST_LOOKBACK_COUNT 4
-
-#define MIN_DIFF 1.0f
-#define MAX_SQR_ERR 3.5f
-#define LOOKBACK_COUNT 6
-
+#define MAGNETIC_LOW 960 /* 31 micro tesla squared */
+#define MAGNETIC_HIGH 3600 /* 60 micro tesla squared */
 
 #ifdef DBG_RAW_DATA
 #define RAW_DATA_FULL_PATH "/data/raw_compass_data_full_%d.txt"
@@ -32,9 +23,9 @@
 
 /* gyro defines */
 #define GYRO_MAX_ERR 0.05f
-#define GYRO_DS_SIZE 8
+#define GYRO_DS_SIZE 100
 
-typedef struct {
+struct compass_cal {
     /* hard iron offsets */
     double offset[3][1];
 
@@ -44,20 +35,23 @@ typedef struct {
     /* geomagnetic strength */
     double bfield;
 
-} calibration_data;
+    /* selection data */
+    float sample[DS_SIZE][3];
+    unsigned int sample_count;
+};
 
 struct gyro_cal {
-    float bias[3];
-    int start;
+    float bias_x, bias_y, bias_z;
     int count;
-    float sample[GYRO_DS_SIZE][3];
+    float min_x, min_y, min_z;
+    float max_x, max_y, max_z;
 };
 
 typedef double mat_input_t[DS_SIZE][3];
 
-void calibrate_compass (struct sensors_event_t* event, int64_t time);
-void compass_read_data (const char* config_path);
-void compass_store_data (const char* config_path);
+void calibrate_compass (struct sensors_event_t* event, struct sensor_info_t* info, int64_t time);
+void compass_read_data (struct sensor_info_t* info);
+void compass_store_data (struct sensor_info_t* info);
 
 void calibrate_gyro(struct sensors_event_t* event, struct sensor_info_t* info);
 void gyro_cal_init(struct sensor_info_t* info);