Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26a922bd authored by Jonas Larsson's avatar Jonas Larsson
Browse files

Optimize and fix light sensor filter

Optimization: Don't compute the sum of all samples in filter window every run. Instead, keep track of the sum, subtract phased out sample, add new sample and divide new sum by number of valid samples. Massive CPU cycle savings.
Thanks to Jonathan (zenpoy on gmail dot com) for pointing me in the right direction!

Fix: The code for stopping the filter if the sensor has been stable the entire filter window time was only enabled if debug logging was enabled. Oops. CPU cycle savings in steady ambient light.
parent aea51add
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment