diff options
Diffstat (limited to 'libsensors')
-rw-r--r-- | libsensors/LightSensor.cpp | 10 | ||||
-rw-r--r-- | libsensors/sensors.cpp | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index e931e2e..3159c9e 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -121,12 +121,10 @@ int LightSensor::readEvents(sensors_event_t* data, int count) while (count && mInputReader.readEvent(&event)) { int type = event->type; if (type == EV_REL) { - // Convert adc value to lux assuming: - // I = 10 * log(Ev) uA - // R = 47kOhm - // Max adc value 4095 = 3.3V - // 1/4 of light reaches sensor - mPendingEvent.light = event->value; + if(event->value < 0) + mPendingEvent.light = 0; + else + mPendingEvent.light = event->value; } else if (type == EV_SYN) { mPendingEvent.timestamp = timevalToNano(event->time); if (mEnabled) { diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp index a0194ef..99bed29 100644 --- a/libsensors/sensors.cpp +++ b/libsensors/sensors.cpp @@ -73,19 +73,19 @@ static const struct sensor_t sSensorList[] = { { "LIS3DH Acceleration Sensor", "STMicroelectronics", 1, SENSORS_ACCELERATION_HANDLE, - SENSOR_TYPE_ACCELEROMETER, RANGE_A, RESOLUTION_A, 0.20f, 10000, { } }, + SENSOR_TYPE_ACCELEROMETER, RANGE_A, RESOLUTION_A, 0.20f, 10000, 0, 0, { } }, { "MS-3R (YAS532) Magnetic Sensor", "Yamaha Corporation", 1, SENSORS_MAGNETIC_FIELD_HANDLE, - SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 0.06f, 6.8f, 10000, { } }, + SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 0.06f, 6.8f, 10000, 0, 0, { } }, { "MS-x Orientation Sensor", "Yamaha Corporation", 1, SENSORS_ORIENTATION_HANDLE, - SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 10000, { } }, + SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 10000, 0, 0, { } }, { "AL3201 Light Sensor", "LITEON", 1, SENSORS_LIGHT_HANDLE, - SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, { } }, + SENSOR_TYPE_LIGHT, 10240.0f, 1.0f, 0.75f, 0, 0, 0, { } }, }; |