sm8150-common: Apply ALS correction to the RAW sensor value

* Probably a derp here 07c6e1a71f

Signed-off-by: Rituj Beniwal <ritujbeniwal@gmail.com>
This commit is contained in:
Rituj Beniwal 2021-05-26 17:31:31 +05:30 committed by Omkar Chandorkar
parent d782530f3a
commit 562f63234f
No known key found for this signature in database
GPG Key ID: 95A33FD984777F70
1 changed files with 4 additions and 2 deletions

View File

@ -73,11 +73,13 @@ void AlsCorrection::correct(float& light) {
correction = correction * (((float) screen_brightness) / ((float) max_brightness));
correction += als_bias;
}
ALOGV("Final correction: %f", correction);
// Sensor is not accurate for low values
if (light < correction) {
if (light - correction >= 0) {
light -= correction;
} else {
light = correction;
}
ALOGV("Corrected reading: %f", light);
}
} // namespace implementation