const char* selected_trigger;
float offset; /* (cooked = raw + offset) * scale */
- float scale; /*default: 1. when set to 0, use channel specific value*/
+ float scale; /*default:1. when set to 0, use channel specific value*/
float illumincalib; /* to set the calibration for the ALS */
float requested_rate; /* requested events / second */
/* Whether or not the above buffer contains data from a device report */
int report_initialized;
+ /* Channel and sample finalization callbacks for this sensor */
struct sample_ops_t ops;
int cal_level; /* 0 means not calibrated */
- /* Depending on the sensor calibration may take too much at higher levels */
+ /*
+ * Depending on the sensor, calibration may take too much time at
+ * higher levels. Allow optional capping to a certain level.
+ */
int max_cal_level;
- void* cal_data;
+
+ void *cal_data; /* Sensor calibration data, e.g. for magnetometer */
/* Filtering data for noisy sensors */
void* filter;
struct compass_cal* cal_data = (struct compass_cal*) info->cal_data;
/*
- * Some sensors take unrealistically long to calibrate at higher levels.
- * We'll use a max_cal_level if we have such a property setup, or go with
- * the default settings if not.
- */
+ * Some sensors take unrealistically long to calibrate at higher levels.
+ * We'll use a max_cal_level if we have such a property setup, or go with
+ * the default settings if not.
+ */
int cal_steps = (info->max_cal_level && info->max_cal_level <= CAL_STEPS) ?
info->max_cal_level : CAL_STEPS;
return 1;
case SENSOR_TYPE_ROTATION_VECTOR:
- return 4;
+ return 4;
default:
ALOGE("Unknown sensor type!\n");
float sensor_get_max_range (int s)
{
-
- if (sensor[s].is_virtual) {
+ if (sensor[s].is_virtual) {
switch (sensor[s].type) {
case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
return 100;
default:
- return 0.0;
+ return 0;
}
}
int i;
int count = sensor_catalog[sensor[s].catalog_index].num_channels;
- if (sensor_get_st_prop(s, "order", buf))
+ if (sensor_get_st_prop(s, "order", buf))
return 0; /* No order property */
/* Assume ASCII characters, in the '0'..'9' range */
cell = &global_history[i];
- cell->sensor = s;
+ cell->sensor = s;
- cell->motion_trigger = (sensor[s].selected_trigger ==
- sensor[s].motion_trigger_name);
+ cell->motion_trigger = (sensor[s].selected_trigger ==
+ sensor[s].motion_trigger_name);
memcpy(&cell->data, event, sizeof(sensors_event_t));
}
return 0;
/*
- There is no transform ops defined yet for Raw sysfs values
- Use this function to perform transformation as well.
- */
+ * There is no transform ops defined yet for raw sysfs values.
+ * Use this function to perform transformation as well.
+ */
if (sensor_type == SENSOR_TYPE_MAGNETIC_FIELD)
return CONVERT_GAUSS_TO_MICROTESLA ((val + offset) * scale) *
correction;