Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

automatic brightness algorithm

359 views
Skip to first unread message

Tsvika

unread,
Oct 7, 2013, 5:40:42 PM10/7/13
to
From what I know,

In FxOS,
If we have the ambient light sensor in the device, the screen_manager.js can add an event listener named "devicelight" to do the automatic brightness.

Once the light sensor reports the value has changed,

the code will finally go to a function "transitionBrightness".

To ensure my understanding is correct, this function will keep looping until the difference between the target brightness and screen brightness is smaller than delta. Otherwise, the system will keep adjusting the brightness in this function.

Is my understanding correct?

mozlov...@gmail.com

unread,
Oct 7, 2013, 5:45:17 PM10/7/13
to
Tsvika於 2013年10月8日星期二UTC+8上午5時40分42秒寫道:
Sorry, here is a misunderstanding.

"Once the light sensor reports the value has changed"----> the system keeps polling the value sent from light sensor. The light sensor wont report any value to the system.

Andreas Gal

unread,
Oct 7, 2013, 5:48:08 PM10/7/13
to Tsvika, dev...@lists.mozilla.org

Roughly. In addition we also have a fairly steep threshold for the target brightness. Once we decided to adjust the brightness the result of the device light sensor has to change a lot before we consider an adjustment again. This is to avoid flickering. This code was hacked together by philikon and myself a long time ago. I am pretty sure its all sorts of suboptimal. Improvements are very welcome.

Andreas
> _______________________________________________
> dev-b2g mailing list
> dev...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-b2g

mozlov...@gmail.com

unread,
Oct 7, 2013, 6:25:46 PM10/7/13
to
Thanks Andreas.

1.The system computed the incoming light and
calculated the clamped value as its target light value.
If the computed value and clamped value are difference,
then go to transition step.

2.In transition step, the system gets the current brightness value
and compares this value to the target value. If the value is larger than
delta, then the brightness will be changed.
The transition step will keep checking the value in each interval time until
the difference is smaller than delta. It returns.

Above is what I checked about how FxOS implements automatic brightness. please let me know if anything I am wrong in my understanding.


I haven't checked the algorithm that Android takes.

The reason why I checked the source of auto brightness because it seems unstable on my FxOS device.

Joshua Smith

unread,
Oct 7, 2013, 10:47:36 PM10/7/13
to mozlov...@gmail.com, dev...@lists.mozilla.org
Hello gaia team!

Something that I would really find helpful is a way to get the current light value.  My apps need to know the ambient light level immediately without waiting for a change event.

Just something to think about =)
Joshua Smith
 
 
On 10/07/13, mozlov...@gmail.com wrote:
 
0 new messages