diff options
Diffstat (limited to 'libsensors/LightSensor.cpp')
-rw-r--r-- | libsensors/LightSensor.cpp | 10 |
1 files changed, 4 insertions, 6 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) { |